-
Notifications
You must be signed in to change notification settings - Fork 144
Description
How can I watch sass files with grunt-browserify and grunt-contrib-watch at the same time?
I tried setting browserify's keepAlive to false but that disables browserify's watch option too.
Running the browserify task with grunt-contrib-watch is not really an option because my bundle is too big for that. I tried a workaround by splitting it into 2 bundles but that isn't a real solution.
Compiling sass in an IDE is not really an option because we have way too many collaborators to make sure that everyone uses the same config for compiling.
If I remove the comment from //'watch' then browserify:frontend_bundle_watch never runs. Moving watch down does not help either.
Using grunt-concurrent makes both of them run once but none of them actually responds to changed files.
Versions:
$ npm list -i --depth=0
├── angular@1.4.8
├── angular-ui-bootstrap@1.0.3
├── bootstrap-sass@3.3.6
├── browserify-ng-html2js@1.1.5
├── console-polyfill@0.2.2
├── font-awesome@4.5.0
├── grunt@0.4.5
├── grunt-browserify@4.0.1
├── grunt-concurrent@2.1.0
├── grunt-contrib-copy@0.8.2
├── grunt-contrib-uglify@0.11.0
├── grunt-contrib-watch@0.6.1
├── grunt-ng-annotate@1.0.1
├── grunt-sass@1.1.0
├── load-grunt-tasks@3.4.0
└── node.normalize.scss@3.0.3
Gruntfile (removed potentially irrelevant lines)
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
/* ... folder variables ... */
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: {
options: {
"watch": true,
"keepAlive": true,
},
frontend_bundle_watch: {
src: frontendAppFolder + "/frontend.js",
dest: compiledFolder + "/app.js",
},
},
/* ... */
sass: {
options: {
sourceMap: false,
includePaths: [vendorFolder],
},
site_frontend: {
options: {
outputStyle: 'nested',
},
src: frontendAppFolder+'/frontend.scss',
dest: compiledFolder+"/app.css"
}
},
watch: {
options: {
spawn: false,
debounceDelay: 100
},
sass_frontend: {
files: frontendAppFolder+"/**/scss/**/*.scss",
tasks: ['sass:site_frontend'],
}
}
});
/* ... */
var buildTasks = [
'browserify:frontend_bundle_watch',
'sass:site_frontend',
/* ... */
];
grunt.registerTask('default', buildTasks.concat([
//'watch',
'browserify:frontend_bundle_watch',
]));