- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Gulp Help
Hi all
I’m learning some build system sorcery with Gulp. I’ve been experiencing a few problems.
Right now I’m following along with the beginner tutorial posted on this site by Zell https://css-tricks.com/gulp-for-beginners/
My issue is at the watcher stage, my ‘watch’ code below isn’t triggering that ‘sass’ task.
Can anyone please help me figure out why this is?
Thanks in advance :D
var gulp = require ('gulp'),
sass = require ('gulp-sass');
//Compiles SASS to CSS
gulp.task ('sass', function() {
return gulp.src ('app/sass/**/*.sass')
.pipe (sass())
.pipe (gulp.dest('app/css/'))
});
//Watchers
gulp.task('watch', function() {
gulp.watch('app/sass/**/*.scss', ['sass']);
});
When you type gulp watch
, after did you change Sass file and save, to see if the watch is triggering? Just running the command doesnt do anything.
To trigger Sass on each gulp watch
gulp.task('watch', ['sass'], function() {
gulp.watch('app/sass/**/*.scss', ['sass']);
});
Yep, I tried to make some changes to a sass file in the app/sass/
directory.
It didn’t trigger, I tried adding in the ‘sass’ task into the parameter of the gulp.task function as you suggested. No cigar either.
I can’t for the life of me figure it out. I’ve tried removing the glob directory pattern /**/*.sass
and just include app/sass/*.sass
. Still nothing.
Thanks :D
Are you watching .sass
or .scss
files?
OMG. I can’t believe I did that. Yep, I was watching the wrong files when I added ['sass']
to the parameters of the watch
task!
Unbelievable, lol. Thank you very much indeed :D I can carry on with my quest.
+1 to you good sir