Skip to content

Commit

Permalink
Improve livereload config
Browse files Browse the repository at this point in the history
  • Loading branch information
black-trooper committed Dec 14, 2017
1 parent a728a12 commit 31e1bd4
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ const rimraf = require('rimraf');

const watch_target = [
'tags/**/*',
'docs/tags/**/*.tag',
'index.js'
];
const demo_watch_target = [
'docs/tags/**/*.tag'
]

// TASK
// ============================================
Expand All @@ -34,22 +36,23 @@ gulp.task('default', function () {
'clean',
'build',
'demo_build',
'watch'
'watch',
'demo_watch'
);
});

gulp.task('clean', function () {
return del([
'dist/**/*',
'docs/dist/**/*'
'dist/**/*'
]);
});

gulp.task('build', function () {
return sequence(
'compile',
'concat',
'compress'
'compress',
'demo_copy'
);
});

Expand Down Expand Up @@ -82,8 +85,7 @@ gulp.task('watch', function () {
'htmlhint',
'eslint',
'clean',
'build',
'demo_build'
'build'
);
});
});
Expand All @@ -103,6 +105,14 @@ gulp.task('htmlhint', function () {
})

// for demo
gulp.task('demo_watch', function () {
gulp.watch(demo_watch_target, function () {
sequence(
'demo_build'
);
});
});

gulp.task('demo_build', function () {
return sequence(
'demo_escape',
Expand All @@ -111,8 +121,7 @@ gulp.task('demo_build', function () {
'demo_clean',
'demo_concat',
'demo_browserify',
'demo_compress',
'demo_copy'
'demo_compress'
);
});

Expand All @@ -130,6 +139,9 @@ gulp.task('demo_htmlhint', function () {
})

gulp.task('demo_compile', function () {
del([
'docs/dist/**/*'
]);
return gulp.src('docs/temp/**/*.tag')
.pipe(riot({
type: 'es6'
Expand Down Expand Up @@ -171,10 +183,20 @@ gulp.task('demo_copy', function () {
})

gulp.task('webserver', function () {
const target = [
'index.html',
'build.js',
'semantic-ui-riot.min.js'
]
return gulp.src('./docs')
.pipe(webserver({
port: 3000,
livereload: true,
livereload: {
enable: true,
filter: function (fileName) {
return target.indexOf(fileName) >= 0
}
},
directoryListening: true,
open: true
}));
Expand Down

0 comments on commit 31e1bd4

Please sign in to comment.