Last active
December 4, 2015 23:59
-
-
Save olafgleba/30823057798be886c78d to your computer and use it in GitHub Desktop.
LibSASS + CSS Injection + Reload bei HTML/JS Änderungen
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
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
var bs = require('browser-sync').create(); | |
var runSequence = require('run-sequence'); | |
gulp.task('browser-sync', function() { | |
bs.init({ | |
server: { | |
baseDir: './' | |
} | |
}); | |
}); | |
gulp.task('sass', function() { | |
return gulp.src('**/*.scss') | |
.pipe(sass()) | |
.pipe(gulp.dest('./styles.css')) | |
.pipe(bs.stream()); | |
}); | |
gulp.task('js', function() { | |
return gulp.src('**/*.js') | |
.pipe(gulp.dest('./base.js')); | |
}); | |
gulp.task('watch-all', function() { | |
gulp.watch('**/*.scss', ['sass']); | |
gulp.watch('**/*.js', ['js']).on('change', bs.reload); | |
gulp.watch('**/*.html').on('change', bs.reload); | |
}); | |
gulp.task('default', function() { | |
runSequence(['sass', 'js', 'watch-all'], 'browser-sync'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment