Skip to content

Instantly share code, notes, and snippets.

@kevinSuttle
Created April 19, 2014 20:17
Show Gist options
  • Save kevinSuttle/11096270 to your computer and use it in GitHub Desktop.
Save kevinSuttle/11096270 to your computer and use it in GitHub Desktop.
Sass + Jekyll + BrowserSync
var gulp = require('gulp');
var sass = require('gulp-sass');
var uncss = require('gulp-uncss');
var prefix = require('gulp-autoprefixer');
var browserSync = require('browser-sync');
gulp.task('sass', function () {
gulp.src('_sass/index.scss')
.pipe(sass({outputStyle: 'compressed'}, {errLogToConsole: true}))
.pipe(prefix("last 2 versions", "> 1%", "ie 8", "Android 2", "Firefox ESR"))
.pipe(gulp.dest('css'))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('jekyll', function () {
require('child_process').spawn('jekyll', ['build'], {stdio: 'inherit'});
});
gulp.task('browser-sync', function() {
browserSync.init(null, {
proxy: "localhost:4000"
});
});
gulp.task('default', ['sass', 'browser-sync'], function () {
require('child_process').spawn('jekyll', ['serve'], {stdio: 'inherit'});
gulp.watch("_sass/*.scss", ['sass']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment