Skip to content

Instantly share code, notes, and snippets.

@mouton-rebelle
Created January 15, 2014 10:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mouton-rebelle/8434320 to your computer and use it in GitHub Desktop.
Save mouton-rebelle/8434320 to your computer and use it in GitHub Desktop.
Working gulpfile with compass & livereload (workaround for compass issue not streaming modified files)
/* global require */
var lr = require('tiny-lr'),
gulp = require('gulp'),
compass = require('gulp-compass'),
livereload = require('gulp-livereload'),
server = lr();
gulp.task('compass', function() {
gulp.src('./sass/*.scss')
.pipe(compass({
bundleExec: true,
css: 'web/medias/css',
sassDir: 'sass',
images: 'web/medias/img'
}));
});
gulp.task('watch', function () {
server.listen(35729, function (err) {
if (err){
return console.log(err);
}
});
gulp.watch('./sass/*.scss', function () {
gulp.run('compass');
});
gulp.watch('./web/medias/css/*.css', function (e) {
server.changed({
body: {
files: [e.path]
}
});
});
});
gulp.task('default', function(){
gulp.run('compass');
gulp.run('watch');
});
@jimthedev
Copy link

In your experience, does this only work if you are compiling all of your sass to a single css? I'm trying to do something similar but with two .css files being generated and I get two reloads triggered. :(

@yemi
Copy link

yemi commented Oct 13, 2014

Is this still the way to go with compass/livereload?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment