使用fileinclude插件时,有没有一种动态的方法可以基于gulp.src语言环境字符串创建gulp.dest文件夹?

时间:2018-11-08 23:54:30

标签: gulp

gulp.task('fileinclude', function () {
    gulp.src(['templates/*.html', 'templates/fr/*.html', 'templates/pt/*.html'])
        .pipe(fileinclude({
            prefix: '@@',
            basepath: '@file'
        }))
        .pipe(gulp.dest('./'));
});

我希望它生成/fr/pt文件夹。与为每个语言环境创建3个不同的gulp.task相比,有没有一种动态的方法来做到这一点?我要避免使用3个不同的gulp.tasks

基本上,此代码的作用是在templates文件夹中组装模板,其中可以包含例如template/index.htmltemplate/fr/index.htmltemplate/pt/index.html,然后将其吐到./

但是在我当前的代码中,它将创建3个index.html文件,这些文件将不起作用。我认为这可能会覆盖它们。无论如何,我的解决方案都坏了。

0 个答案:

没有答案