Created
October 16, 2017 22:10
-
-
Save jonsuh/26e624df5725a43610bc3dc2f2b04eec to your computer and use it in GitHub Desktop.
Jekyll CSS Hot Reloading with Browsersync
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 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()); | |
}); |
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
{ | |
"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