use cssnano instead of clean-css for the minified CDN build
This commit is contained in:
parent
f6b862c2a3
commit
75cc3ca305
2 changed files with 16 additions and 4 deletions
10
package-lock.json
generated
10
package-lock.json
generated
|
|
@ -5,7 +5,7 @@
|
|||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "2.2.11",
|
||||
"version": "2.2.12",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"arg": "^5.0.1",
|
||||
|
|
@ -81,6 +81,8 @@
|
|||
"integrity": "sha512-lcy6Lymft9Rpfqmrqdd4oTDdUx9ZwaAhAfywVrHG4771Pa6PPT0danJ1kDHBXYqh4HHSmIdA+nlmfxfxSDPtBg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.2",
|
||||
"chokidar": "^3.4.0",
|
||||
"commander": "^4.0.1",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"fs-readdir-recursive": "^1.1.0",
|
||||
|
|
@ -3211,6 +3213,7 @@
|
|||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"fsevents": "~2.3.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
|
|
@ -4254,7 +4257,8 @@
|
|||
"esprima": "^4.0.1",
|
||||
"estraverse": "^5.2.0",
|
||||
"esutils": "^2.0.2",
|
||||
"optionator": "^0.8.1"
|
||||
"optionator": "^0.8.1",
|
||||
"source-map": "~0.6.1"
|
||||
},
|
||||
"bin": {
|
||||
"escodegen": "bin/escodegen.js",
|
||||
|
|
@ -6382,6 +6386,7 @@
|
|||
"@types/node": "*",
|
||||
"anymatch": "^3.0.3",
|
||||
"fb-watchman": "^2.0.0",
|
||||
"fsevents": "^2.3.2",
|
||||
"graceful-fs": "^4.2.4",
|
||||
"jest-regex-util": "^27.0.6",
|
||||
"jest-serializer": "^27.0.6",
|
||||
|
|
@ -7054,6 +7059,7 @@
|
|||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import fs from 'fs'
|
|||
import postcss from 'postcss'
|
||||
import tailwind from '..'
|
||||
import CleanCSS from 'clean-css'
|
||||
import cssnano from 'cssnano'
|
||||
|
||||
function buildDistFile(filename, config = {}, outFilename = filename) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
@ -20,8 +21,13 @@ function buildDistFile(filename, config = {}, outFilename = filename) {
|
|||
return result
|
||||
})
|
||||
.then((result) => {
|
||||
const minified = new CleanCSS().minify(result.css)
|
||||
fs.writeFileSync(`./dist/${outFilename}.min.css`, minified.styles)
|
||||
return postcss([cssnano]).process(result.css, {
|
||||
from: `./${filename}.css`,
|
||||
to: `./dist/${outFilename}.min.css`,
|
||||
})
|
||||
})
|
||||
.then((result) => {
|
||||
fs.writeFileSync(`./dist/${outFilename}.min.css`, result.css)
|
||||
})
|
||||
.then(resolve)
|
||||
.catch((error) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue