File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export interface IMinifyPluginOpts extends AllowTransformOpts {
2323 include ?: Filter | Filter [ ]
2424 exclude ?: Filter | Filter [ ]
2525 targets ?: string | string [ ]
26+ test ?: RegExp
2627 implementation ?: Implementation
2728}
2829
Original file line number Diff line number Diff line change @@ -24,15 +24,17 @@ export class ParcelCssMinifyPlugin {
2424 private readonly transform : TransformType
2525
2626 constructor ( opts : IMinifyPluginOpts = { } ) {
27- const { implementation, ...otherOpts } = opts
27+ const { implementation, ...otherOpts } = opts
2828 if ( implementation && typeof implementation . transform !== 'function' ) {
2929 throw new TypeError (
3030 `[ParcelCssMinifyPlugin]: implementation.transform must be an '@parcel/css' transform function. Received ${ typeof implementation . transform } `
3131 )
3232 }
3333
3434 this . transform = implementation ?. transform ?? _transform
35- this . options = otherOpts
35+ this . options = {
36+ ...otherOpts
37+ }
3638 }
3739
3840 apply ( compiler : Compiler ) {
@@ -88,6 +90,7 @@ export class ParcelCssMinifyPlugin {
8890 const {
8991 include,
9092 exclude,
93+ test : testRegExp ,
9194 targets : userTargets ,
9295 ...transformOptions
9396 } = this . options
@@ -97,7 +100,7 @@ export class ParcelCssMinifyPlugin {
97100 // Filter out already minimized
98101 ! asset . info . minimized &&
99102 // Filter out by file type
100- CSS_FILE_REG . test ( asset . name ) &&
103+ ( testRegExp || CSS_FILE_REG ) . test ( asset . name ) &&
101104 matchObject ( { include, exclude } , asset . name )
102105 )
103106
You can’t perform that action at this time.
0 commit comments