Skip to content

Commit

Permalink
use cssnano instead of clean-css for the minified CDN build
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Sep 8, 2021
1 parent f6b862c commit 75cc3ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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) => {
Expand Down

0 comments on commit 75cc3ca

Please sign in to comment.