0

I have the following gulpfile.js

 var gulp = require('gulp'), browserSync = require('browser-sync'), sass = require('gulp-sass'), bower = require('gulp-bower'), notify = require('gulp-notify'), reload = browserSync.reload, bs = require("browser-sync").create(), Hexo = require('hexo'), hexo = new Hexo(process.cwd(), {}); var src = { scss: './scss/', css: './source/css', ejs: 'layout' }, watchFiles = [ './scss/*.scss', '*/*.ejs' ]; // Static Server + watching scss/html files gulp.task('serve', ['sass:watch'], function() { // init starts the server bs.init(watchFiles, { server: { baseDir: "../../public" }, logLevel: "debug" }); hexo.init(); hexo.call('generate', {}, function(){ console.log('Started Hexo Server'); }) }); 

How does one start hexo in a watch in a gulpfile?

The rest of the gulpfile is here:

https://github.com/chrisjlee/hexo-theme-zurb-foundation/blob/master/gulpfile.js

The hexo index file takes in arguments here; but i couldn't figure out the arguments;

https://github.com/hexojs/hexo/blob/master/lib/hexo/index.js

1 Answer 1

2

You can pass arguments in the second parameter. For example:

hexo.init().then(function(){ return hexo.call('generate', {watch: true}); }).catch(function(err){ console.log(err); }); 
Sign up to request clarification or add additional context in comments.

1 Comment

Ah thanks Tommy. Glad to see you on here as well. I'll be sure to update the documentation on hexo.io.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.