Answer the question
In order to leave comments, you need to log in
Gulps.js html files?
Please tell me, when you run gulp watch, index.html automatically opens in the browser, if I have more than one html file, how can I change the loading of the html I need?
gulp.task('watch', ['sass', 'scripts', 'browser-sync'], function() {
gulp.watch('app/sass/**/*.sass', ['sass'] );
gulp.watch(['libs/**/*.js', 'app/js/common.js'], ['scripts']);
gulp.watch('app/*.html', browserSync. reload);
});
Answer the question
In order to leave comments, you need to log in
The first option, in the browser-sync settings in gulpfile.js, specify the page that should open when executing gulp watch
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
// Static server
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: "./",
index: "other.html"
}
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question