var与文件数gulp-count

时间:2016-04-14 10:58:29

标签: javascript node.js gulp

我有一个Gulp任务,它返回文件夹中文件的数量。 该任务正常,但我需要获取此值以使“If”订购它。

我的任务:

gulp.task('numberFiles', function() {
    nmFiles += gulp.src('finals/**.*')
        .pipe(count('<%= counter %>'));
        return true;
});

有了这个值,我想让我的自定义任务像这样:

gulp.task('ordermyfiles',['copying'], function() {
    return gulp.src('finals/_*.js') 
        .pipe(order([

            //loop to order my files 
            //I need the value of  count('<%= counter %>');
            //With count('<%= counter %>') just recive and object
            "finals/_file1.js",
            "finals/_file2.js",
            "finals/_file3.js",
            "finals/_file4.js",
        ]))
        .pipe(concat("FinalFile.js"))
        .pipe(gulp.dest("dist/"));
});

有人知道,我该如何实施呢?

BR, 基督教

0 个答案:

没有答案