Skip to content

Commit

Permalink
fix: update to cssnano 5 (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludofischer committed Aug 12, 2021
1 parent a03c7bf commit 118253e
Show file tree
Hide file tree
Showing 4 changed files with 3,087 additions and 3,455 deletions.
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -44,7 +44,7 @@
"jest": "^26.6.3",
"less": "^3.12.2",
"node-sass": "^5.0.0",
"postcss": "^8.1.14",
"postcss": "^8.2.7",
"rollup": "^2.34.2",
"stylus": "^0.54.8",
"sugarss": "^3.0.3",
Expand All @@ -53,7 +53,7 @@
"dependencies": {
"chalk": "^4.1.0",
"concat-with-sourcemaps": "^1.1.0",
"cssnano": "^4.1.10",
"cssnano": "^5.0.1",
"import-cwd": "^3.0.0",
"p-queue": "^6.6.2",
"pify": "^5.0.0",
Expand Down Expand Up @@ -103,4 +103,4 @@
"next"
]
}
}
}
4 changes: 2 additions & 2 deletions src/index.js
Expand Up @@ -224,7 +224,7 @@ export default (options = {}) => {
let { code, codeFileName, map, mapFileName } = getExtracted()
// Perform cssnano on the extracted file
if (postcssLoaderOptions.minimize) {
const cssOptions = postcssLoaderOptions.minimize
const cssOptions = {}
cssOptions.from = codeFileName
if (sourceMap === 'inline') {
cssOptions.map = { inline: true }
Expand All @@ -233,7 +233,7 @@ export default (options = {}) => {
cssOptions.to = codeFileName
}

const result = await require('cssnano').process(code, cssOptions)
const result = await require('cssnano')(postcssLoaderOptions.minimize).process(code, cssOptions)
code = result.css

if (sourceMap === true && result.map && result.map.toString) {
Expand Down

0 comments on commit 118253e

Please sign in to comment.