File tree Expand file tree Collapse file tree
test/configCases/css/minimize-experiments-true Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " webpack " : patch
3+ ---
4+
5+ Minify CSS assets whose names include fragment suffixes.
Original file line number Diff line number Diff line change @@ -173,6 +173,6 @@ cssMinify.getEmbeddedTypes = () => [
173173 * @param {string } name asset filename
174174 * @returns {boolean } true for CSS assets
175175 */
176- cssMinify . filter = ( name ) => / \. c s s ( \? .* ) ? $ / i. test ( name ) ;
176+ cssMinify . filter = ( name ) => / \. c s s (?: [ ? # ] .* ) ? $ / i. test ( name ) ;
177177
178178module . exports = cssMinify ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ module.exports = {
2020 // Emitted by another plugin and unclaimed, so the built-in minifier takes
2121 // it too — a copied stylesheet still gets minimized.
2222 expect ( read ( "copied.css" ) ) . toBe ( ".copied{color:red}" ) ;
23+ expect ( read ( "fragment.css" ) ) . toBe ( ".fragment{color:red}" ) ;
2324
2425 // Already marked `minimized`, so a minimizer the user configured has
2526 // handled it — webpack must leave it exactly as it was.
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ class EmitOtherCssAssetsPlugin {
3131 "copied.css" ,
3232 new sources . RawSource ( ".copied {\n\tcolor : red ;\n}\n" )
3333 ) ;
34+ // A legacy plugin may still assign an asset directly. The output filesystem
35+ // strips the fragment, but the minimizer sees this original name first.
36+ compilation . assets [ "fragment.css#dark" ] = new sources . RawSource (
37+ ".fragment {\n\tcolor : red ;\n}\n"
38+ ) ;
3439 compilation . emitAsset (
3540 "already.css" ,
3641 new sources . RawSource ( ".already {\n\tcolor : red ;\n}\n" ) ,
You can’t perform that action at this time.
0 commit comments