Skip to content

Commit

Permalink
新增transform参数
Browse files Browse the repository at this point in the history
  • Loading branch information
bplok20010 committed Oct 17, 2020
1 parent 805bc33 commit 3d9ee34
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ transformEs( src, dest, options );
raw: {
test: /\.svg$/,
},
// (stream, options, meta) => stream
transform: null
}
```

Expand Down
3 changes: 3 additions & 0 deletions lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ module.exports = async function compile(file, options) {
stream = cssLoader(stream, options, meta);
stream = rawLoader(stream, options, meta);
stream = babelLoader(stream, options, meta);
if (options.transform) {
stream = transform(stream, options, meta);
}
}
stream = stream.pipe(gulp.dest(outDir));

Expand Down
2 changes: 2 additions & 0 deletions lib/defaultOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ module.exports = function (options) {
raw: {
test: /\.svg$/,
},
//function noop(chunk, enc, cb) { cb(null, chunk);}
transform: null,
};

return defaultsDeep({}, options, defaults);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "transform-es",
"version": "5.4.0",
"version": "5.5.0",
"description": "",
"keywords": [
"compile",
Expand Down

0 comments on commit 3d9ee34

Please sign in to comment.