import gulp from 'gulp'
import requireDir from 'require-dir'
import del from 'del'
import path from 'path'
import childProcess from 'child_process'

(function () {
    'use strict'

    const tasks = requireDir('./gulp')

    gulp.task('build', ['inject', 'assets', 'config'], () => {
        gulp.start('package')
        return gulp.src('./cube/**/*.*')
            .pipe(gulp.dest('../cube'))
    })

    gulp.task('clean', () => {
        return del('./cube')
    })

    gulp.task('default', ['build'], () => {
        gulp.start('clean')
    })

    gulp.task('watch', ['default'], () => {
        gulp.watch([
            path.join('./layout/**/*.ejs'),
            path.join('./languages/*.yml'),
            path.join('./source/sass/**/*.scss'),
            path.join('./source/js/**/*.js'),
            path.join('./_config.yml')
        ], (event) => {
            gulp.start('default')
            childProcess.exec('cd ../.. & hexo clean & hexo g', (err) => {
                if (err) console.log('产生错误', err)
                console.log('请执行hexo s开启服务器查看效果')
            })
            // event.type === 'changed'
        })
    })

})()
@@ -215,16 +215,198 @@
 gulp')%0A%0A
+    gulp.task('debug', %5B'inject', 'assets', 'config'%5D, () =%3E %7B%0A        gulp.start('package')%0A        return gulp.src('./cube/**/*.*')%0A            .pipe(gulp.dest('../cube'))%0A    %7D)%0A%0A
     gulp
@@ -482,32 +482,85 @@
 tart('package')%0A
+        del.sync(%5B'./cube/source/js/script.js.map'%5D)%0A
         return g
@@ -727,21 +727,21 @@
 ult', %5B'
-build
+debug
 '%5D, () =
@@ -1375,12 +1375,91 @@
     %7D)%0A%0A
+    gulp.task('deploy', %5B'clean'%5D, () =%3E %7B%0A        gulp.start('build')%0A    %7D)%0A%0A
 %7D)()

add build theme cube