javascript - Gulp file not updating/building css in browser -
so can compile scss css fine.
however, whenever change in scss file has no effect on page unless build styles.
my gulp file:
var gulp = require('gulp'); var sass = require('gulp-sass'); var concatcss = require('gulp-concat-css'); // gulp watches gulp.task('watch', function() { gulp.watch('app/scss/**/*.scss', ['sass']); // sass watch // gulp.watch('dist/css/main.css'); }); // sass compiler gulp.task('sass', function() { return gulp.src('app/scss/**/*.scss') .pipe(sass()) // convert sass css .pipe(gulp.dest('app/css')) }); // compile css files gulp.task('styles', function () { return gulp.src('app/css/**/*.css') .pipe(concatcss('main.css')) .pipe(gulp.dest('dist/css')); }); /** default builds **/ // build gulp.task('build', ['styles']); // watch , build changes gulp.task('default', ['build', 'watch']);
my index.html file linked dist css file correct also?
<link rel="stylesheet" type="text/css" href="dist/css/main.css">
all keeps happening gulp watch files okay if change (something simple body background colour) nothing happens. not on hard refresh. have gulp build styles. new gulp/learning surely building styles after every change cannot right?
thank suggestions. know asked compiling, worked out why wasn't working, i've been going around in circles one.
i think happens watch task of gulp compiling css sass, not concatenating css in dist/css/main.css
.
add task styles
watch method of gulp , try again:
// gulp watches gulp.task('watch', function() { gulp.watch('app/scss/**/*.scss', ['sass', 'styles']); // sass watch });
hope helps! :)
Comments
Post a Comment