Skip to content

Commit 15448f1

Browse files
committed
add ability to skip files via user-defined function
1 parent b02ef8b commit 15448f1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/optimize/UglifyJsPlugin.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ function UglifyJsPlugin(options) {
1717
module.exports = UglifyJsPlugin;
1818
UglifyJsPlugin.prototype.apply = function(compiler) {
1919
var options = this.options;
20+
var skipFile = options.skipFile || function(filename) {
21+
// UglifyJs only applies to javascript
22+
return !/\.js($|\?)/i.test(filename);
23+
};
2024
var requestShortener = new RequestShortener(compiler.context);
2125
compiler.plugin("compilation", function(compilation) {
2226
compilation.plugin("build-module", function(module) {
@@ -34,8 +38,7 @@ UglifyJsPlugin.prototype.apply = function(compiler) {
3438
files.push(file);
3539
});
3640
files.forEach(function(file) {
37-
if(!/\.js($|\?)/i.test(file)) {
38-
// UglifyJs only applies to javascript
41+
if(skipFile(file)) {
3942
return;
4043
}
4144
var oldWarnFunction = uglify.AST_Node.warn_function;

0 commit comments

Comments
 (0)