Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
More or less like this:
// Require
var gulp = require( 'gulp' );
var pug = require( 'gulp-pug' );
var browserSync = require( 'browser-sync' ).create();
// Compile
gulp.task( 'pug', function () {
return gulp.src( 'pug/*.pug', { since: gulp.lastRun( 'pug' ) } )
.pipe( pug() )
.pipe( gulp.dest( './dist/' ) );
});
// BrowserSync
gulp.task( 'browsersync', function () {
browserSync.init({ server: './dist/' });
return browserSync.watch( '**/*.*' ).on( 'change', browserSync.reload );
});
// Watch
gulp.task( 'watch', function () {
return gulp.watch( 'pug/*.pug', gulp.series( 'pug' ) );
});
// Default task
gulp.task( 'default', gulp.series( 'pug', gulp.parallel( 'browsersync', 'watch' ) ) );
// Пример для gulp#4.0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question