-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·48 lines (41 loc) · 1.65 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
var gulp = require('gulp');
var childProcess = require('child_process');
var package = require('./package.json');
var browserSync = require('./gulp/tasks/browser-sync');
var pugTask = require('./gulp/tasks/pug');
var staticTask = require('./gulp/tasks/static');
var sassTask = require('./gulp/tasks/sass');
var svgSpriteTask = require('./gulp/tasks/svg-sprite');
var webpackTask = require('./gulp/tasks/webpack');
var handlebarsTask = require('./gulp/tasks/handlebars');
var options = require('./gulp/options');
function setProduction(done) {
process.argv.push('--production');
done();
}
var buildTask = gulp.series(
gulp.parallel(staticTask, svgSpriteTask),
gulp.parallel(sassTask, webpackTask, pugTask)
);
var watchTask = function (done) {
// gulp.watch(options.handlebars.src, handlebarsTask);
gulp.watch(options.pug.src, pugTask);
gulp.watch(options.sass.src, sassTask);
gulp.watch(options.static.src, staticTask);
gulp.watch(options.webpack.src, webpackTask);
gulp.watch(options.svgSprite.src, svgSpriteTask);
browserSync.task(done);
}
gulp.task('default', gulp.series(buildTask, watchTask));
gulp.task('build', buildTask);
gulp.task('stage', gulp.series(setProduction, buildTask));
gulp.task('sass', sassTask);
gulp.task('static', staticTask);
gulp.task('webpack', webpackTask);
gulp.task('svg-sprite', svgSpriteTask);
gulp.task('pug', gulp.series(svgSpriteTask, pugTask));
// gulp.task('handlebars', gulp.series(svgSpriteTask, handlebarsTask));
gulp.task('serve', gulp.series(buildTask, browserSync.task));
gulp.task('watch', watchTask);
// Set console title to package name
childProcess.exec('title ' + package.name);