Skip to content

Instantly share code, notes, and snippets.

@bdecarne
Forked from aslansky/gist:8741515
Created April 11, 2014 07:23
Show Gist options
  • Save bdecarne/10446520 to your computer and use it in GitHub Desktop.
Save bdecarne/10446520 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var lr = require('tiny-lr');
var http = require('http');
var path = require('path');
var ecstatic = require('ecstatic');
var tlr = lr();
var livereload = function (evt, filepath) {
tlr.changed({
body: {
files: path.relative(__dirname, filepath)
}
});
};
gulp.task('styles', function () {
return gulp.src('./src/scss/main.scss')
.pipe(sass())
.pipe(gulp.dest('./dist/css'));
});
gulp.task('default', function() {
http.createServer(ecstatic({root: __dirname})).listen(8080);
gutil.log(gutil.colors.blue('HTTP server listening on port 8080'));
tlr.listen(35729);
gutil.log(gutil.colors.blue('Livereload server listening on port 35729'));
gulp.watch('src/scss/**', ['styles'])._watcher.on('all', livereload);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment