Add gulp live rebuild support
This commit is contained in:
parent
e9e649a3b9
commit
966c521605
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ _site/
|
|||
.sass-cache/
|
||||
.jekyll-metadata
|
||||
Gemfile.lock
|
||||
node_modules/
|
||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "_plugins/asset_bundler"]
|
||||
path = _plugins/asset_bundler
|
||||
url = https://github.com/moshen/jekyll-asset_bundler.git
|
1
_plugins/asset_bundler
Submodule
1
_plugins/asset_bundler
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit ec2b2cd8dd8d622d3ada6bb1171a1f5c187c8448
|
46
gulpfile.js
Normal file
46
gulpfile.js
Normal 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
6
package.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.2.0",
|
||||
"gulp": "^3.7"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue