Skip to content

Instantly share code, notes, and snippets.

@floatdrop
Created June 20, 2014 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floatdrop/44fb27635cd0e4fe5b43 to your computer and use it in GitHub Desktop.
Save floatdrop/44fb27635cd0e4fe5b43 to your computer and use it in GitHub Desktop.
Rebuilding index.html with gulp-inject on scss file changes
'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