Calling gulp to do stuff with file stream build;

const gulp = require('gulp')
const gulpUtil = require('gulp-util')

function runGulp() {
    gulpUtil.log('stuff happened', 'Really it did', gulpUtil.colors.magenta('123'));
    gulp.watch('./*.css', css)
}

//whenever when the sass file changes,
function css(cb) {
    mylog(22)

    gulp.src('*.css').pipe(gulp.dest('css/'))//pipe method receives file stream,,
    gulp.src('*.html').pipe(gulp.dest('html/'))//pipe method receives file stream,,
    // body omitted
    cb();
}

module.exports = {
    runGulp
}

I have sealed gulp in a single file and do not want to define gulpfile and tasks but use it in nodejs, this stull can watch glob, and do building etc.

posted @ 2022-07-01 20:43  calochCN  阅读(12)  评论(0编辑  收藏  举报