Skip to content

Commit 3e14379

Browse files
committed
added minimize query option
1 parent fdf00d2 commit 3e14379

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ By default the css-loader minimizes the css if specified by the module system.
6464

6565
In some cases the structural minification is destructive to the css, so you can disable it with the `disableStructuralMinification` query parameter. `require("css-loader?disableStructuralMinification!./file.css")`
6666

67+
You can also disable or enforce minification with the `minimize` query parameter.
68+
69+
`require("css-loader?minimize!./file.css")` (enforced)
70+
71+
`require("css-loader?-minimize!./file.css")` (disabled)
72+
6773
## License
6874

6975
MIT (http://www.opensource.org/licenses/mit-license.php)

index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ module.exports = function(content) {
1010
var result = [];
1111
var query = loaderUtils.parseQuery(this.query);
1212
var root = query.root;
13+
var forceMinimize = query.minimize;
14+
var minimize = typeof forceMinimize !== "undefined" ? !!forceMinimize : (this && this.minimize);
1315
var tree = csso.parse(content, "stylesheet");
14-
if(tree && this && this.minimize) {
16+
if(tree && minimize) {
1517
tree = csso.compress(tree, query.disableStructuralMinification);
1618
tree = csso.cleanInfo(tree);
1719
}

0 commit comments

Comments
 (0)