Created
June 20, 2014 04:54
-
-
Save floatdrop/44fb27635cd0e4fe5b43 to your computer and use it in GitHub Desktop.
Rebuilding index.html with gulp-inject on scss file changes
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
'use strict'; | |
var watch = require('gulp-watch'), | |
inject = require('gulp-inject'), | |
sass = require('gulp-sass'), | |
gulp = require('gulp'), | |
es = require('event-stream'); | |
gulp.task('default', function () { | |
watch({glob: 'sass/*.scss'}, function(scss) { | |
// Compiling new and changed scss files | |
var css = scss | |
.pipe(sass()) | |
.pipe(gulp.dest('build')); | |
// rebuilding index.html with gulp-inject | |
return gulp.src('index.html') | |
.pipe(inject(es.merge(css, gulp.src('build/*.css')))) | |
.pipe(gulp.dest('build')); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment