-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watching sass and browserify js files at the same time #374
Comments
Hello Parts of my config: # order is important
grunt.registerTask 'default', ['browserify:dev', 'less:dev', 'connect', 'watch']
grunt.initConfig {
# ...
# dev static server with livereload
connect:
dev:
options:
# no keepalive!
debug : false
port : 9000
hostname : '*'
livereload: true
base : ['.', 'dist']
watch:
options:
atBegin : false
livereload: true
less:
options:
livereload: false # no reload page after update
interrupt : true
files: ['src/**/*.less']
tasks: ['less:dev']
css: # for hotreload styles
files: ['dist/styles.css']
tasks: []
spawn: false
js: # for autoreload page
files: ['dist/*.js']
tasks: []
# ...
browserify:
dev:
options:
# ...
# no keepalive!
watch: true
files:
'dist/lib.js': ['src/lib.coffee']
'dist/app.js': ['src/app.coffee']
less:
dev:
files:
'dist/styles.css': ['src/**/*.less', '!src/less/import/**/*.less']
} |
@ovcharik does your console output when a file is built include the text
I believe @dsge is trying to get it to run with watchify. I'm also looking for a solution as my build is a little slower than I'd like it to be but I need to run grunt-contrib-watch for other assets. |
@wesvetter this solution for combining From documentation:
I'm turn on |
Option https://github.com/jmreidy/grunt-browserify/blob/master/lib/runner.js#L33 //determine watchify or browserify
var b = options.watch ? this.watchify(this.browserify(bOpts), wOpts) : this.browserify(bOpts); Although option https://github.com/jmreidy/grunt-browserify/blob/master/lib/runner.js#L161 self.logger.log.ok('Bundle ' + destination.cyan + ' created. ' + (options.keepAlive ? 'Watchifying...' : ''));
self.writer.write(destination, buf); e. g.
String By the way it works well with persistent cache in my project. And in my project with similarly configuration, the first build via To successfully build is necessary to set In this case, after completion of the first build, ps: sorry for my English. |
@ovcharik Sorry for the delay (was on holiday), turns out you are correct. The Thanks for your help, I owe you a beer! ps: your English is fine 😄 |
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'swatch
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'
thenbrowserify:frontend_bundle_watch
never runs. Movingwatch
down does not help either.Using
grunt-concurrent
makes both of them run once but none of them actually responds to changed files.Versions:
Gruntfile (removed potentially irrelevant lines)
The text was updated successfully, but these errors were encountered: