-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
executable file
·55 lines (45 loc) · 1.34 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const gulp = require('gulp');
const gulpSync = require('gulp-sync')(gulp);
const requireTasksDir = require('require-dir');
const packageJson = require('./package.json');
const config = {
packageJson,
port: 3000,
phpPort: 3838,
localhost: 'localhost'
};
const developmentPaths = {
pages: 'src/**/*.php',
fonts: 'src/fonts/**/*.*',
images: 'src/images/**/*.*',
styles: 'src/css/**/*.sass',
scripts: 'src/js/**/*.js'
};
const themes = 'wordpress/wp-content/themes/';
const theTheme = themes + packageJson.name;
const paths = Object.assign({
basePath: 'wordpress/',
styleWp: 'src/style.css',
configWp: 'wp-config.php',
pluginsWp: 'plugins/**/*.*',
themesWp: themes,
pagesDest: theTheme,
fontsDest: `${theTheme}/fonts`,
imagesDest: `${theTheme}/images`,
stylesDest: `${theTheme}/css`,
scriptsDest: `${theTheme}/js`
}, developmentPaths);
gulp.paths = paths;
gulp.config = config;
requireTasksDir('tasks');
gulp.task('wp', gulpSync.sync(['wp-install']));
gulp.task('default', gulpSync.sync(['build', 'watch', 'connect-sync']));
gulp.task('build', gulpSync.sync(['clean', 'styles', 'scripts', 'pages', 'images', 'fonts', 'libs']));
gulp.task('watch', () => {
const paths = Object.keys(developmentPaths);
paths.map(path => {
const task = path;
// Combine each development path with a task
return gulp.watch(gulp.paths[path], [task]);
});
});