Skip to content

Commit

Permalink
fix: fix minified css
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Feb 24, 2021
1 parent b0d876b commit d6f433f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@types/debug": "^4.1.5",
"@types/marked": "^1.2.2",
"@types/prismjs": "^1.16.3",
"csso": "^4.2.0",
"clean-css": "^5.1.0",
"debug": "^4.3.1",
"esbuild": "^0.8.51",
"prettier": "^2.2.1",
Expand Down
7 changes: 5 additions & 2 deletions rollup-plugin-windicss.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
WindiPluginUtils,
createUtils,
} from '@windicss/plugin-utils'
import CleanCSS from 'clean-css'

const NAME = 'rollup-plugin-windicss'
const MODULE_ID = 'windi.css'
Expand Down Expand Up @@ -39,6 +40,8 @@ function WindiCssRollupPlugin(userOptions = {}) {
const options = resolveOptions(userOptions)
let chunks = []

const cleanCSS = new CleanCSS()

return {
name: NAME,

Expand Down Expand Up @@ -82,10 +85,10 @@ function WindiCssRollupPlugin(userOptions = {}) {
}
},

generateBundle(_, bundle, isWrite) {
generateBundle() {
let code = chunks.join('\n')
if (userOptions.minify) {
code = require('csso').minify(code).css
code = cleanCSS.minify(code).styles
}
this.emitFile({
type: 'asset',
Expand Down
29 changes: 8 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,13 @@ chalk@^2.0.0:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

clean-css@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.1.0.tgz#f3cc8ba900ab23b316e753330d15425149be36f1"
integrity sha512-98ALLW4NOhZpvUEoSc2dJO23xE4S4SXc4mLieCVFGo8DNLTFQ3gzi7msW1lqSYJeGZSF5r5+W3KF6cEnkILnFQ==
dependencies:
source-map "~0.6.0"

clipboard@^2.0.0:
version "2.0.6"
resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.6.tgz#52921296eec0fdf77ead1749421b21c968647376"
Expand Down Expand Up @@ -460,21 +467,6 @@ convert-source-map@^1.7.0:
dependencies:
safe-buffer "~5.1.1"

css-tree@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.1.2.tgz#9ae393b5dafd7dae8a622475caec78d3d8fbd7b5"
integrity sha512-wCoWush5Aeo48GLhfHPbmvZs59Z+M7k5+B1xDnXbdWNcEF423DoFdqSWE0PM5aNk5nI5cp1q7ms36zGApY/sKQ==
dependencies:
mdn-data "2.0.14"
source-map "^0.6.1"

csso@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/csso/-/csso-4.2.0.tgz#ea3a561346e8dc9f546d6febedd50187cf389529"
integrity sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==
dependencies:
css-tree "^1.1.2"

debug@^4.1.0, debug@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
Expand Down Expand Up @@ -719,11 +711,6 @@ marked@^2.0.0:
resolved "https://registry.yarnpkg.com/marked/-/marked-2.0.0.tgz#9662bbcb77ebbded0662a7be66ff929a8611cee5"
integrity sha512-NqRSh2+LlN2NInpqTQnS614Y/3NkVMFFU6sJlRFEpxJ/LHuK/qJECH7/fXZjk4VZstPW/Pevjil/VtSONsLc7Q==

[email protected]:
version "2.0.14"
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50"
integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==

merge2@^1.3.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
Expand Down Expand Up @@ -909,7 +896,7 @@ source-map@^0.5.0:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=

source-map@^0.6.0, source-map@^0.6.1:
source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
Expand Down

1 comment on commit d6f433f

@vercel
Copy link

@vercel vercel bot commented on d6f433f Feb 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.