Add gulp live rebuild support

This commit is contained in:
Jesper Hess 2016-04-08 21:10:31 +02:00
parent e9e649a3b9
commit 966c521605
5 changed files with 57 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ _site/
.sass-cache/
.jekyll-metadata
Gemfile.lock
node_modules/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "_plugins/asset_bundler"]
path = _plugins/asset_bundler
url = https://github.com/moshen/jekyll-asset_bundler.git

@ -0,0 +1 @@
Subproject commit ec2b2cd8dd8d622d3ada6bb1171a1f5c187c8448

46
gulpfile.js Normal file
View File

@ -0,0 +1,46 @@
var gulp = require('gulp');
var browserSync = require('browser-sync');
var cp = require('child_process');
var messages = {
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
};
/**
* Build the Jekyll Site
*/
gulp.task('jekyll-build', function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn('bundle.bat', ['exec','jekyll','build'], {stdio: 'inherit'})
.on('close', done);
});
/**
* Rebuild Jekyll & do page reload
*/
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
browserSync.reload();
});
/**
* Wait for jekyll-build, then launch the Server
*/
gulp.task('browser-sync', ['jekyll-build'], function() {
browserSync.init({
server: '_site'
});
});
/**
* Watch html/md files, run jekyll & reload BrowserSync
* if you add folder for pages, collection or datas, add them to this list
*/
gulp.task('watch', function () {
gulp.watch(['./*', '_layouts/*', '_pages/*', '_includes/*', '_posts/*', '_sass/*', 'css/*'], ['jekyll-rebuild']);
});
/**
* Default task, running just `gulp` will compile the sass,
* compile the jekyll site, launch BrowserSync & watch files.
*/
gulp.task('default', ['browser-sync', 'watch']);

6
package.json Normal file
View File

@ -0,0 +1,6 @@
{
"devDependencies": {
"browser-sync": "^2.2.0",
"gulp": "^3.7"
}
}