Answer the question
In order to leave comments, you need to log in
gulp-livereload not working whats wrong?
var
gulp= require("gulp"),
livereload= require("gulp-livereload");
gulp.task("reload-css", function(){
gulp.src('./src/*.css')
.pipe(livereload());
});
gulp.task("default", function() {
livereload.listen();
gulp.watch('./src/*.css',['reload-css']);
});
Answer the question
In order to leave comments, you need to log in
This configuration works for me. I also had to dance a lot with a tambourine. The point, most likely, is in the return in the task functions. Well, do not forget to install and activate the browser plugin.
var gulp = require("gulp");
var concat = require("gulp-concat");
var sass = require("gulp-sass");
var postcss = require("postcss");
var autoprefixer = require("gulp-autoprefixer");
var cssnano = require("gulp-cssnano");
var livereload = require('gulp-livereload');
var autoprefixer_options = {
"browserslist": [
'> 1%',
'last 2 versions',
'firefox >= 4',
'safari 7',
'safari 8',
'IE 8',
'IE 9',
'IE 10',
'IE 11'
],
cascade: false
};
gulp.task('sass', function(){
return gulp.src( "ams_www_modx/assets/ams_modx/scss/style.scss" )
.pipe( sass().on("error", sass.logError) )
//.pipe( concat("style.css") )
.pipe( autoprefixer({ overrideBrowserslist: ['last 6 versions'] }) )
//.pipe( cssnano() )
.pipe( gulp.dest("ams_www_modx/assets/ams_modx/css") )
.pipe( livereload({host: "127.0.0.1", port: "35729"}) );
});
gulp.task('reload', function(){
return gulp.src( "ams_www_modx/assets/ams_modx/**/*.{html,php}" )
.pipe(livereload({host: "127.0.0.1", port: "35729"}));
log("///////////////////");
});
gulp.task('default', function(){
livereload.listen({host: "127.0.0.1", port: "35729"});
gulp.watch( ["ams_www_modx/assets/**/*.scss", "!ams_www_modx/assets/img/**/*"], gulp.series('sass') );
gulp.watch( ["ams_www_modx/assets/**/*.{html,php}", "!ams_www_modx/assets/img/**/*"], gulp.series('reload') );
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question