源文件的gulp映射及其目标路径

时间:2018-04-03 09:54:22

标签: path gulp yaml

是否可以拥有类似源文件地图及其目标路径的内容。

config.yml类似

entries:    
- source:"node_modules/jquery2/dist/jquery.js"
  destination: "jquery/2/jquery.js"
- source: "node_modules/jquery3/dist/jquery.js"
  destination: "jquery/3/jquery.js"

而不是像这样的gulp任务

function javascripts() {
  return gulp.src(PATHS.javascripts)
    //.pipe($.debug({title: 'dest'}))
    .pipe($.sourcemaps.init())
    .pipe($.if(PRODUCTION, $.uglify()
      .on('error', e => { console.log(e); })
    ))
    .pipe($.if(!PRODUCTION, $.sourcemaps.write()))
    .pipe($.rename(function (path) {
      path.dirname = path.dirname.replace('src/assets/', '');
    }))
    /*.pipe(gulp.dest( function(file) {
      echo file.dirname;
      //var path = file.base.replace('src/assets/js/', '');
      return ($.if(PRODUCTION, PATHS.production , PATHS.staging  ))
    }))*/
    //.pipe($.flatten({ includeParents: 3} ))
    .pipe($.if(PRODUCTION,
      gulp.dest(PATHS.production),
      gulp.dest(PATHS.staging)
    ));
}

我们需要创建类似脚本版本的CDN。

0 个答案:

没有答案