Skip to content

Commit 9939d51

Browse files
committed
chore: gulp bump up version to 4.0
1 parent cf7c4a7 commit 9939d51

File tree

3 files changed

+1249
-1361
lines changed

3 files changed

+1249
-1361
lines changed

gulpfile.js

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
'use strict';
22

3-
var gulp = require('gulp');
4-
var $ = require('gulp-load-plugins')();
3+
const gulp = require('gulp');
4+
const $ = require('gulp-load-plugins')();
55

66
require('es6-promise').polyfill();
77

8-
var runSequence = require('run-sequence');
8+
const browserSync = require('browser-sync').create();
99

10-
var browserSync = require('browser-sync').create();
11-
var reload = browserSync.reload;
12-
13-
var src_paths = {
10+
const src_paths = {
1411
sass: ['sass/_flexbox-grid-mixins.scss'],
1512
docs_sass: ['docs/sass/*.scss'],
1613
docs_static: ['docs/*.html', 'docs/**/*.html']
1714
};
1815

19-
var dest_paths = {
16+
const dest_paths = {
2017
browserSync: 'docs',
2118
docs_css: 'docs/css/'
2219
};
2320

24-
gulp.task('lint:sass', function() {
21+
function lint_sass() {
2522
return gulp.src(src_paths.sass)
2623
.pipe($.plumber({
2724
errorHandler: function(err) {
@@ -46,9 +43,9 @@ gulp.task('lint:sass', function() {
4643
console: true
4744
}]
4845
}));
49-
});
46+
};
5047

51-
gulp.task('docs_sass', function() {
48+
function docs_sass() {
5249
return gulp.src(src_paths.docs_sass)
5350
.pipe($.plumber({
5451
errorHandler: function(err) {
@@ -64,32 +61,30 @@ gulp.task('docs_sass', function() {
6461
}))
6562
.pipe(gulp.dest(dest_paths.docs_css))
6663
.pipe(browserSync.stream());
67-
});
64+
}
6865

69-
gulp.task('browser-sync', function() {
66+
function browser_sync(done) {
7067
browserSync.init({
7168
server: {
7269
baseDir: dest_paths.browserSync
73-
}
70+
},
71+
reloadOnRestart: true
7472
});
73+
done();
74+
}
7575

76-
gulp.watch(src_paths.sass, ['default']).on('change', reload);
77-
gulp.watch(src_paths.docs_sass, ['docs_sass']);
78-
gulp.watch(src_paths.docs_static).on('change', reload);
79-
});
80-
81-
gulp.task('lint', ['lint:sass']);
82-
gulp.task('serve', ['browser-sync']);
76+
function watch_files(done) {
77+
const browserReload = () => {
78+
browserSync.reload();
79+
done();
80+
};
8381

84-
gulp.task('default', function(callback) {
85-
runSequence(
86-
'lint',
87-
'docs_sass',
88-
callback
89-
);
90-
});
82+
gulp.watch(src_paths.sass).on('change', gulp.series(lint_sass, docs_sass, browserReload));
83+
gulp.watch(src_paths.docs_sass).on('change', gulp.series(lint_sass, docs_sass, browserReload));
84+
gulp.watch(src_paths.docs_static).on('change', browserReload);
85+
}
9186

92-
gulp.task('watch', function() {
93-
gulp.watch(src_paths.sass, ['default']);
94-
gulp.watch(src_paths.docs_sass, ['docs_sass']);
95-
});
87+
exports.docs_sass = docs_sass;
88+
exports.lint = lint_sass;
89+
exports.serve = gulp.series(browser_sync, watch_files);
90+
exports.default = gulp.series(lint_sass, docs_sass);

0 commit comments

Comments
 (0)