gulp 二つのタスクを実行

gulp.task defaultでmsgであとに実行したい処理を書いて、そのgulp, taskでfunctionの前に呼び出す。

1
2
3
4
5
6
7
8
9
10
11
12
var gulp = require('gulp');
 
gulp.task('html', function(){
    return gulp.src('./src/*.html')
        .pipe(gulp.dest('./dest'))
});
 
gulp.task('msg', ['html'], function(){
    console.log('hello');
});
 
gulp.task('default', ['msg']);

[vagrant@localhost front]$ gulp
[20:15:16] Using gulpfile ~/local/front/gulpfile.js
[20:15:16] Starting ‘html’…
[20:15:16] Finished ‘html’ after 14 ms
[20:15:16] Starting ‘msg’…
hello
[20:15:16] Finished ‘msg’ after 40 μs
[20:15:16] Starting ‘default’…
[20:15:16] Finished ‘default’ after 10 μs