mirror of
https://github.com/bitwarden/help
synced 2025-12-14 23:33:37 +00:00
control jekyll with gulp
This commit is contained in:
@@ -15,9 +15,7 @@ The bitwarden help center project is written using Jekyll, which is hosted/deplo
|
|||||||
|
|
||||||
Run the following commands:
|
Run the following commands:
|
||||||
- `npm install`
|
- `npm install`
|
||||||
- `gulp build`
|
- `gulp`
|
||||||
- `jekyll build`
|
|
||||||
- `jekyll serve`
|
|
||||||
|
|
||||||
You can now access the help center at `http://localhost:4009`.
|
You can now access the help center at `http://localhost:4009`.
|
||||||
|
|
||||||
|
|||||||
44
gulpfile.js
44
gulpfile.js
@@ -4,7 +4,10 @@ var gulp = require('gulp'),
|
|||||||
rename = require('gulp-rename'),
|
rename = require('gulp-rename'),
|
||||||
runSequence = require('run-sequence'),
|
runSequence = require('run-sequence'),
|
||||||
ghPages = require('gulp-gh-pages'),
|
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 = {};
|
var paths = {};
|
||||||
paths.dist = './_site/';
|
paths.dist = './_site/';
|
||||||
@@ -72,4 +75,43 @@ gulp.task('lib', ['clean:lib'], function () {
|
|||||||
gulp.task('deploy', [], function () {
|
gulp.task('deploy', [], function () {
|
||||||
return gulp.src(paths.dist + '**/*')
|
return gulp.src(paths.dist + '**/*')
|
||||||
.pipe(ghPages({ cacheDir: '../.publish_cache/help' }));
|
.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);
|
||||||
});
|
});
|
||||||
@@ -13,6 +13,9 @@
|
|||||||
"font-awesome": "4.7.0",
|
"font-awesome": "4.7.0",
|
||||||
"jquery": "2.1.4",
|
"jquery": "2.1.4",
|
||||||
"lunr": "0.7.1",
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user