Skip to content

Instantly share code, notes, and snippets.

@iansinnott
Last active July 9, 2016 19:37
Show Gist options
  • Save iansinnott/a9175e41f521a56eae52 to your computer and use it in GitHub Desktop.
Save iansinnott/a9175e41f521a56eae52 to your computer and use it in GitHub Desktop.
A gulpfile for working with Jekyll
// gulpfile.js
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename'),
shell = require('gulp-shell'),
livereload = require('gulp-livereload'),
lr = require('tiny-lr'),
server = lr();
gulp.task('sass', function() {
return gulp.src('sass/style.scss')
.pipe(sass())
.pipe(autoprefixer( 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4' ))
.pipe(minifycss())
.pipe(rename('style.min.css'))
.pipe(gulp.dest('public/css'))
.pipe(gulp.dest('_site/public/css'))
.pipe(livereload(server));
});
gulp.task('build', shell.task([ 'jekyll build' ]));
gulp.task('watch', function() {
server.listen(35729, function(err) {
if (err)
return console.log(err);
gulp.watch('sass/**/*.scss', ['sass']);
gulp.watch([
'_includes/**/*.html',
'_layouts/**/*.html',
'_posts/**/*'
], ['build']);
});
});
@tobiasoberrauch
Copy link

I can't find tiny-lr :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment