specify file types
This commit is contained in:
parent
84a37da74b
commit
02c46cd72a
6
index.js
6
index.js
|
@ -6,16 +6,12 @@ require("babel-preset-es2017");
|
|||
|
||||
module.exports = function(embark) {
|
||||
|
||||
embark.registerPipeline(function(opts) {
|
||||
embark.registerPipeline((embark.pluginConfig.files || ['*.js', '*.jsx']), function(opts) {
|
||||
var targetFile = opts.targetFile;
|
||||
var source = opts.source;
|
||||
var presets = embark.pluginConfig.presets || ['es2015', 'es2016', 'es2017', 'react'];
|
||||
var minified = (embark.pluginConfig.minified !== undefined ? embark.pluginConfig.minified : true);
|
||||
|
||||
if (targetFile.split('.').slice(-1)[0] !== 'js' ) {
|
||||
return source;
|
||||
}
|
||||
|
||||
return babel.transform(source, {minified: minified, presets: presets}).code;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue