Skip to content

Commit 348df61

Browse files
authored
feat: provide minified distribution of themes (#10223)
1 parent 36d7d2b commit 348df61

File tree

6 files changed

+479
-58
lines changed

6 files changed

+479
-58
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"author": "Vaadin Ltd",
55
"type": "module",
66
"scripts": {
7-
"analyze": "polymer analyze packages/**/vaadin-*.js > analysis.json && node scripts/prepareDocs.js && node scripts/buildWebtypes.js",
7+
"analyze": "polymer analyze packages/**/vaadin-*.js > analysis.json && node scripts/prepareDocs.js && node scripts/buildWebtypes.js && yarn workspace @vaadin/aura build && yarn workspace @vaadin/vaadin-lumo-styles build",
88
"api-docs:start": "yarn analyze && yarn workspace api-docs generate ../analysis.json && yarn workspace api-docs start",
99
"api-docs:build": "yarn analyze && yarn workspace api-docs generate ../analysis.json && yarn workspace api-docs build",
1010
"debug": "yarn test --watch",

packages/aura/package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
},
1919
"main": "aura.css",
2020
"type": "module",
21+
"scripts": {
22+
"build": "postcss ./aura.css --dir dist"
23+
},
2124
"files": [
25+
"dist",
2226
"src",
2327
"*.css"
2428
],
@@ -28,5 +32,12 @@
2832
"design-system",
2933
"web-components",
3034
"web-component"
31-
]
35+
],
36+
"devDependencies": {
37+
"cssnano": "^7.1.1",
38+
"postcss": "^8.1.0",
39+
"postcss-cli": "^11.0.1",
40+
"postcss-import": "^16.1.1",
41+
"postcss-url": "^10.1.3"
42+
}
3243
}

packages/aura/postcss.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import cssNano from 'cssnano';
2+
import fs from 'fs';
3+
import path from 'path';
4+
import postCssImport from 'postcss-import';
5+
import postCssUrl from 'postcss-url';
6+
7+
export default {
8+
plugins: [
9+
postCssImport(),
10+
postCssUrl({
11+
filter: 'src/fonts/**',
12+
url: (asset) => {
13+
// Copy font files to the dist directory, while dropping "src" from the relative path
14+
const relativePath = path.relative('src', asset.relativePath);
15+
const distPath = path.join('dist', relativePath);
16+
fs.mkdirSync(path.dirname(distPath), { recursive: true });
17+
fs.copyFileSync(asset.absolutePath, distPath);
18+
return relativePath;
19+
},
20+
}),
21+
cssNano({
22+
preset: 'default',
23+
}),
24+
],
25+
};

packages/vaadin-lumo-styles/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"module": "all-imports.js",
2121
"type": "module",
2222
"scripts": {
23+
"build": "postcss ./{lumo,utility}.css --dir dist",
2324
"icons": "gulp icons"
2425
},
2526
"files": [
@@ -28,6 +29,7 @@
2829
"*.js",
2930
"!gulpfile.js",
3031
"components/*.css",
32+
"dist",
3133
"mixins/*.d.ts",
3234
"mixins/*.js",
3335
"presets",
@@ -46,11 +48,15 @@
4648
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha19"
4749
},
4850
"devDependencies": {
51+
"cssnano": "^7.1.1",
4952
"gulp": "^5.0.1",
5053
"gulp-cli": "^3.1.0",
5154
"gulp-iconfont": "^12.0.0",
5255
"gulp-plugin-extras": "^1.0.0",
5356
"imagemin": "^9.0.0",
54-
"imagemin-svgo": "^10.0.1"
57+
"imagemin-svgo": "^10.0.1",
58+
"postcss": "^8.1.0",
59+
"postcss-cli": "^11.0.1",
60+
"postcss-import": "^16.1.1"
5561
}
5662
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import cssNano from 'cssnano';
2+
import postCssImport from 'postcss-import';
3+
4+
export default {
5+
plugins: [
6+
postCssImport(),
7+
cssNano({
8+
preset: 'default',
9+
}),
10+
],
11+
};

0 commit comments

Comments
 (0)