gulp添加管道以转换为Vinyl对象 [英] gulp add pipe to convert to Vinyl objects

查看:259
本文介绍了gulp添加管道以转换为Vinyl对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经升级到gulp 4.0.2 版本,我需要更新任务之一

I have upgraded to gulp 4.0.2 version I need to update one of the tasks

const debug = require('gulp-debug');
const i18nextParser = require('i18next-parser');

function myTask() {
  return gulp
    .src(['./js/**/*.js', './js/**/*.jsx'])
    .pipe(
      i18nextParser({
        locales: ['en', 'de'],
        functions: ['translate'],
        output: '/opt/locales/'
      })
    )
    .pipe(debug())
    .pipe(gulp.dest('/opt/locales/'));
});

我希望将这些文件转换为Vinyl对象:

I want these files to be converted to Vinyl objects:

[17:04:32] gulp-debug: opt/locales/de/translation.json
[17:04:32] gulp-debug: opt/locales/de/translation_old.json
[17:04:32] gulp-debug: opt/locales/en/translation.json
[17:04:32] gulp-debug: opt/locales/en/translation_old.json

否则我有错

Error: Received a non-Vinyl object in `dest()`

是否存在可以通过管道传递的功能以使此任务正常运行?

Is there a function that I can pipe to in order to make this task work properly?

i18next-parser 的版本为 0.7.0 .升级到最新的 3.6.0 版本根本不会产生任何输出.

i18next-parser version is 0.7.0. Upgrading to latest 3.6.0 version doesn't produce any output at all.

推荐答案

所以我通过使用 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆