Skip to content

Instantly share code, notes, and snippets.

@chrisvasey
Created July 19, 2016 14:47
Show Gist options
  • Save chrisvasey/37ac9cc94f07f7b0a1fd3aef46f095ba to your computer and use it in GitHub Desktop.
Save chrisvasey/37ac9cc94f07f7b0a1fd3aef46f095ba to your computer and use it in GitHub Desktop.
//npm install browser-sync gulp --save-dev
var gulp = require("gulp");
var less = require('gulp-less');
var path = require('path');
var browserSync = require("browser-sync").create();
// Static Server + watching scss/html files
gulp.task('serve', ['less'], function() {
browserSync.init({
server: "./"
});
gulp.watch("css/**/*.less", ['less']);
gulp.watch("./*.html").on('change', browserSync.reload);
});
/**
* Compile with gulp-less + source maps
*/
gulp.task('less', function () {
return gulp.src('./css/**/*.less')
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(gulp.dest('./public/css'))
.pipe(browserSync.stream({match: '**/*.css'}));
});
gulp.task('default', ['serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment