Created
January 15, 2014 10:56
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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'); | |
}); | |
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
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. :(