Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit abe50c6

Browse files
committed
cssNano option
1 parent bc43b18 commit abe50c6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

css-plugin-base-builder.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
8484

8585
var cwd = process.cwd();
8686

87-
return postcss([atImport({
87+
var postCssPlugins = [atImport({
8888
resolve: function(fileName, dirname, opts) {
8989
if (absUrl(fileName))
9090
return fileName;
@@ -134,9 +134,14 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
134134
else
135135
return path.relative(baseURLPath, path.join(dirname, fileName)).replace(/\\/g, '/');
136136
}
137-
}), autoprefixer, cssnano({
138-
normalizeUrl: false
139-
})])
137+
}), autoprefixer];
138+
139+
if (loader.cssNano !== false)
140+
postCssPlugins.push(cssnano({
141+
normalizeUrl: false
142+
}));
143+
144+
return postcss(postCssPlugins)
140145
.process(Object.keys(inputFiles).map(name => '@import "' + name + '";').join('\n'), {
141146
from: path.join(baseURLPath, '__.css'),
142147
to: cwd + path.sep + '__.css',

0 commit comments

Comments
 (0)