grunt-contrib-watch
grunt-contrib-watch copied to clipboard
run compass on the main.css when partials change
Hiya,
I'd like to run compass on the main.css (src/sass), which contains only imports of my partials located in folders within the same directory (src/sass/*_/__.scss), when one of the partials changes but I seem to be missing something...
grunt.initConfig({
compass: {
dist: {
options: {
sassDir: 'src/sass',
cssDir: 'src/stylesheets',
outputStyle: 'expanded'
}
}
},
watch: {
css: {
files: ['src/sass/*/.scss'],
tasks: ['compass'],
options: {
livereload:true
},
},
}
});
it always runs compass only when I save main.css but does nothing when i save any of my partials, could you help please?! :)
Thanks a lot!
Your options for watch
should look like this:
watch: {
css: {
files: ['src/sass/**/*.scss'],
tasks: ['compass'],
options: {
livereload: true
}
}
}
Note the use of the *
symbol on the files
line. The double asterisk looks for anything in the root folder and any subfolder, then the single asterisk looks for any file with a .scss
extension. Hope this helps.
Also, the issue tracker for this project isn't really the right place for specific questions. You should use Stack Overflow for those in the future.
Hi,
thanks for getting back to me...unfortunately it is still not working, it detects changes only on my main.scss located in src/sass/main.scss but when I change any of the partials within src/sass/**/_partial.scss it's not doing anything.
M.
Sorry but I can't really suggest anything else without seeing a file tree and your Gruntfile.js in its current state.
Here you go...I took a snapshot of my gruntfile as i noticed it changes is when i copy paste here as i actually had it correctly in there originally just got changed with the copy paste in here...although there is still something i'm missing obviously...
the main.scss is actually screen.scss in this case
Thanks so much for your help! :)
Well I'm stumped. I can't see anything you're doing wrong. The only other option is to try using the grunt-contrib-sass compiler with the Compass flag and see if that fixes your issue. Although I'm familiar with Compass I no longer use it and instead compile with the Libsass grunt-sass task.
mmm, okay...oh, well i give it a try, thanks a lot for your help though! :)