Skip to content

Commit 6eb0afe

Browse files
Minify CSS (#274)
This PR minifies the CSS and ensures only necessary files are included in the dist
1 parent d277447 commit 6eb0afe

File tree

3 files changed

+637
-9
lines changed

3 files changed

+637
-9
lines changed

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"name": "@rolemodel/optics",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"packageManager": "yarn@4.2.2",
55
"description": "Optics is a css package that provides base styles and components that can be integrated and customized in a variety of projects.",
66
"main": "dist/css/optics.css",
77
"scripts": {
88
"test": "exit 0",
9-
"build": "yarn build:css && yarn build:css-min && yarn build:tokens",
10-
"build:css": "mkdir -p dist/css; rsync -a src/ dist/css --exclude stories",
11-
"build:css-min": "postcss src/optics.css -o dist/css/optics.min.css",
9+
"build": "yarn build:css && yarn build:css-min && yarn build:tokens && yarn build:files",
10+
"build:css": "postcss src/optics.css -o dist/css/optics.css",
11+
"build:css-min": "postcss src/optics.css -o dist/css/optics.min.css --env=minify",
1212
"build:tokens": "node build_token_json --source=src/core/tokens --output=dist/tokens/tokens.json",
13+
"build:files": "mkdir -p dist/; cp LICENSE README.md package.json dist/",
1314
"storybook": "storybook dev -p 6006 --docs",
1415
"build-storybook": "storybook build --docs",
1516
"lint": "yarn lint:js && yarn lint:css",
@@ -54,6 +55,7 @@
5455
"@storybook/preview-api": "^8.5.3",
5556
"@storybook/test": "^8.5.3",
5657
"@storybook/theming": "^8.5.3",
58+
"cssnano": "^7.0.6",
5759
"eslint": "^8.45.0",
5860
"eslint-config-prettier": "^9.1.0",
5961
"eslint-config-standard": "^17.1.0",

postcss.config.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
module.exports = {
2-
plugins: [require('postcss-import')],
3-
}
1+
module.exports = (context) => ({
2+
plugins: {
3+
'postcss-import': {},
4+
cssnano: context.env === 'minify' ? {} : false,
5+
},
6+
})

0 commit comments

Comments
 (0)