Skip to content

Only load cssnano if we're going to use it. #472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/processCss.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var localByDefault = require("postcss-modules-local-by-default");
var extractImports = require("postcss-modules-extract-imports");
var modulesScope = require("postcss-modules-scope");
var modulesValues = require("postcss-modules-values");
var cssnano = require("cssnano");

var parserPlugin = postcss.plugin("css-loader-parser", function(options) {
return function(css) {
Expand Down Expand Up @@ -141,7 +140,7 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
var minimize = typeof forceMinimize !== "undefined" ? !!forceMinimize : options.minimize;

var customGetLocalIdent = query.getLocalIdent || getLocalIdent;

var parserOptions = {
root: root,
mode: options.mode,
Expand Down Expand Up @@ -179,6 +178,7 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
]);

if(minimize) {
var cssnano = require("cssnano");
var minimizeOptions = assign({}, query.minimize);
["zindex", "normalizeUrl", "discardUnused", "mergeIdents", "reduceIdents", "autoprefixer"].forEach(function(name) {
if(typeof minimizeOptions[name] === "undefined")
Expand Down