Skip to content

Instantly share code, notes, and snippets.

@jonsuh
Created October 16, 2017 22:10
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 jonsuh/26e624df5725a43610bc3dc2f2b04eec to your computer and use it in GitHub Desktop.
Save jonsuh/26e624df5725a43610bc3dc2f2b04eec to your computer and use it in GitHub Desktop.
Jekyll CSS Hot Reloading with Browsersync
var gulp = require('gulp');
var changed = require('gulp-changed-in-place');
var browserSync = require('browser-sync').create();
gulp.task('watch', ['css'], function() {
browserSync.init({
server: "./_site"
});
gulp.watch("_site/css/**/*.css", ['css']);
});
gulp.task('css', function() {
return gulp.src("_site/css/**/*.css")
.pipe(changed())
.pipe(browserSync.stream());
});
{
"name": "example.com",
"version": "1.0.0",
"devDependencies": {
"browser-sync": "^2.18.13",
"gulp": "^3.9.1",
"gulp-changed-in-place": "^2.3.0",
"parallelshell": "^3.0.1"
},
"scripts": {
"watch": "parallelshell 'bundle exec jekyll build --watch' 'gulp watch'"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment