angular-cn/tools/build/transpile.js

25 lines
809 B
JavaScript
Raw Normal View History

var util = require('./util');
var gulpTraceur = require('../transpiler/gulp-traceur');
var file2moduleName = require('./file2modulename');
var mergeStreams = require('event-stream').merge;
module.exports = function(gulp, plugins, config) {
return function() {
var transpile = gulp.src(config.src)
.pipe(plugins.rename({extname: '.'+config.outputExt}))
.pipe(util.renameSrcFolder(plugins, config.srcFolderMapping))
.pipe(gulpTraceur(
config.options,
file2moduleName)
)
.pipe(gulp.dest(config.dest));
var copy = gulp.src(config.copy)
.pipe(plugins.rename({extname: '.'+config.outputExt}))
.pipe(util.renameSrcFolder(plugins, config.srcFolderMapping))
.pipe(gulp.dest(config.dest));
return mergeStreams(transpile, copy);
};
};