1
0
mirror of https://github.com/bitwarden/help synced 2025-12-15 07:43:48 +00:00

control jekyll with gulp

This commit is contained in:
Kyle Spearrin
2017-05-25 12:03:01 -04:00
parent 463871ab96
commit 9f2d583259
3 changed files with 48 additions and 5 deletions

View File

@@ -15,9 +15,7 @@ The bitwarden help center project is written using Jekyll, which is hosted/deplo
Run the following commands:
- `npm install`
- `gulp build`
- `jekyll build`
- `jekyll serve`
- `gulp`
You can now access the help center at `http://localhost:4009`.

View File

@@ -4,7 +4,10 @@ var gulp = require('gulp'),
rename = require('gulp-rename'),
runSequence = require('run-sequence'),
ghPages = require('gulp-gh-pages'),
merge = require('merge-stream');
merge = require('merge-stream'),
gulpUtil = require('gulp-util'),
child = require('child_process'),
browserSync = require('browser-sync').create();
var paths = {};
paths.dist = './_site/';
@@ -73,3 +76,42 @@ gulp.task('deploy', [], function () {
return gulp.src(paths.dist + '**/*')
.pipe(ghPages({ cacheDir: '../.publish_cache/help' }));
});
function jekyll(commands, cb) {
var jekyllLogger = (buffer) => {
buffer.toString()
.split(/\n/)
.forEach((message) => gulpUtil.log(message));
};
var jekyllCommand = process.platform === "win32" ? "jekyll.bat" : "jekyll";
var jekyll = child.spawn(jekyllCommand, commands);
jekyll.stdout.on('data', jekyllLogger);
jekyll.stderr.on('data', jekyllLogger);
jekyll.stderr.on('close', cb);
return jekyll;
}
gulp.task('jekyll:build', function (cb) {
return jekyll(['build', '--watch'], cb);
});
gulp.task('jekyll:serve', function (cb) {
return jekyll(['serve', '--watch'], cb);
});
gulp.task('serve', () => {
return browserSync.init({
files: [paths.dist + '/**'],
port: 4009,
server: {
baseDir: paths.dist
}
});
});
gulp.task('default', function (cb) {
return runSequence(
'build',
'jekyll:serve',
cb);
});

View File

@@ -13,6 +13,9 @@
"font-awesome": "4.7.0",
"jquery": "2.1.4",
"lunr": "0.7.1",
"fluidbox": "2.0.0"
"fluidbox": "2.0.5",
"gulp-util": "3.0.8",
"child_process": "1.0.2",
"browser-sync": "2.18.12"
}
}