Last active
August 29, 2015 14:13
-
-
Save winkerVSbecks/e239b3eb0a3598334ac9 to your computer and use it in GitHub Desktop.
Jekyll and Gulp
This file contains hidden or 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
var gulp = require('gulp'); | |
var connect = require('gulp-connect'); | |
var watch = require('gulp-watch'); | |
var exec = require('gulp-exec'); | |
var livereload = require('gulp-livereload'); | |
var sass = require('gulp-ruby-sass'); | |
var minifyCss = require('gulp-minify-css'); | |
var rename = require('gulp-rename'); | |
gulp.task('sass', function(done) { | |
gulp.src('./scss/app.scss') | |
.pipe(sass({ | |
sourcemap: false, | |
sourcemapPath: '../scss' | |
})) | |
.on('error', function (err) { | |
console.log(err.message); | |
}) | |
.pipe(minifyCss()) | |
.pipe(rename({ | |
extname: '.min.css' | |
})) | |
.pipe(gulp.dest('./css/')) | |
.pipe(connect.reload()) | |
.on('end', done); | |
}); | |
gulp.task('dev', function(){ | |
// Start a server | |
connect.server({ | |
root: '_site', | |
port: 3000, | |
livereload: true | |
}); | |
console.log('Server running at http://localhost:3000/'); | |
watch({ | |
glob: ['public/**', '_posts/**', 'about.md'] | |
}) | |
.pipe(exec('jekyll build')) | |
.pipe(connect.reload); | |
// Watch HTML files for changes | |
console.log('[CONNECT] Watching SASS files'.blue); | |
gulp.watch('./scss/*.scss', ['sass']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment