Skip to content

Commit a5729c7

Browse files
committed
add filename filter
1 parent c8494f3 commit a5729c7

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ new ExtractTextPlugin(options: filename | object)
6464
* `options.allChunks: boolean` extract from all additional chunks too (by default it extracts only from the initial chunk(s))
6565
* `options.disable: boolean` disables the plugin
6666
* `options.id: string` Unique ident for this plugin instance. (For advanced usage only, by default automatically generated)
67+
* `filenamefilter` function to modify path and filename before files are emitted
68+
```
69+
{
70+
filenamefilter: function(filename) {
71+
// modify filename
72+
return filename;
73+
}
74+
}
75+
```
6776

6877
The `ExtractTextPlugin` generates an output file per entry, so you must use `[name]`, `[id]` or `[contenthash]` when using multiple entries.
6978

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ ExtractTextPlugin.prototype.apply = function(compiler) {
309309
}).replace(/\[(?:(\w+):)?contenthash(?::([a-z]+\d*))?(?::(\d+))?\]/ig, function() {
310310
return loaderUtils.getHashDigest(source.source(), arguments[1], arguments[2], parseInt(arguments[3], 10));
311311
});
312+
file = (options.filenamefilter) ? options.filenamefilter(file) : file;
312313
compilation.assets[file] = source;
313314
chunk.files.push(file);
314315
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "extract-text-webpack-plugin",
2+
"name": "extract-text-webpack-plugin-steamer",
33
"version": "2.0.0-beta.5",
44
"author": "Tobias Koppers @sokra",
55
"description": "Extract text from bundle into a file.",

0 commit comments

Comments
 (0)