Запустить hexo для создания часов в gulpfile.js?

У меня есть следующий файл 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');
    })

});

Как запустить hexo в часах в gulpfile?

Остальная часть gulpfile находится здесь:

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

Здесь шестнадцатеричный индексный файл принимает аргументы; но я не мог понять аргументы;

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


person chrisjlee    schedule 06.06.2015    source источник


Ответы (1)


Вы можете передавать аргументы во втором параметре. Например:

hexo.init().then(function(){
  return hexo.call('generate', {watch: true});
}).catch(function(err){
  console.log(err);
});
person Tommy Chen    schedule 07.06.2015
comment
Ах, спасибо, Томми. Рад видеть тебя здесь тоже. Обязательно обновлю документацию на hexo.io. - person chrisjlee; 09.06.2015