Skip to content

Instantly share code, notes, and snippets.

@apisandipas
Created October 21, 2014 17:04
Show Gist options
  • Select an option

  • Save apisandipas/6cfc70d69eec2a9767df to your computer and use it in GitHub Desktop.

Select an option

Save apisandipas/6cfc70d69eec2a9767df to your computer and use it in GitHub Desktop.
Simple Gulp Setup for SCSS and livereload
var gulp = require('gulp'),
$ = require('gulp-load-plugins')();
var config = {
scss_src: 'assets/scss/**/*.scss',
css_dest: 'assets/css'
};
gulp.task('css', function() {
gulp.src( config.scss_src )
.pipe( $.plumber() ) // error handling w/o breaking streams
.pipe( $.sourcemaps.init() ) // generate sourcemaps
.pipe( $.sass() ) // preprocess css
.pipe( $.sourcemaps.write('./')) // write sourcemaps
.pipe( gulp.dest( config.css_dest ) ); // write compiles files
});
gulp.task('watch', ['css'],function() {
$.livereload.listen();
gulp.watch( config.scss_src ).on('change', $.livereload.changed);
gulp.watch( config.scss_src, ['css'] );
});
gulp.task('default', ['watch']);
{
"name": "gulp-demo",
"version": "0.0.1",
"devDependencies": {
"gulp": "^3.8.8",
"gulp-livereload": "^2.1.1",
"gulp-load-plugins": "^0.7.0",
"gulp-plumber": "^0.6.6",
"gulp-rsync": "0.0.4",
"gulp-sass": "^1.1.0",
"gulp-shell": "^0.2.10",
"gulp-sourcemaps": "^1.2.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment