Skip to content

Instantly share code, notes, and snippets.

@olafgleba
Last active December 4, 2015 23:59
Show Gist options
  • Save olafgleba/30823057798be886c78d to your computer and use it in GitHub Desktop.
Save olafgleba/30823057798be886c78d to your computer and use it in GitHub Desktop.
LibSASS + CSS Injection + Reload bei HTML/JS Änderungen
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