Created
October 21, 2014 17:04
-
-
Save apisandipas/6cfc70d69eec2a9767df to your computer and use it in GitHub Desktop.
Simple Gulp Setup for SCSS and livereload
This file contains hidden or 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
| 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']); |
This file contains hidden or 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
| { | |
| "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