feat: Load custom properties CSS file and auto-generate on change#11827
feat: Load custom properties CSS file and auto-generate on change#11827cdrini merged 5 commits intointernetarchive:masterfrom
Conversation
|
@lokesh I didn't get to try this yet. But based on my other use of this script I have a question. |
… consistency across builds
Good point. For now, I've removed the timestamp from the generated file which will prevent unnecessary file modifications that show up in git commits. We could have the build step generate files and do a diff to compare before deciding on updating the timestamp, but that might be overkill. Went with the simplest solution. |
| * DO NOT EDIT THIS FILE DIRECTLY! | ||
| * Run: node scripts/generate-css-custom-properties.js | ||
| * | ||
| * Generated: 2026-01-12T19:33:19.310Z |
There was a problem hiding this comment.
Wooohooo!! I was wondering what was causing this file to appear modified all the time, great fix!
Load CSS custom properties as a standalone stylesheet and auto-regenerate them on each webpack build.
Technical
scripts/generate-css-custom-properties.jsvia thebeforeCompilehook, sogenerated-custom-properties.cssis always regenerated before a build (including in watch mode).<link>tag that loadsgenerated-custom-properties.cssso they can be utilized by our web components and other CSS files.generated-custom-properties.cssTesting
docker compose run --rm home npm run buildand verify static/css/less/generated-custom-properties.css is regenerated with the latest values.docker compose run --rm home npm run watch:css) and change a LESS variable, confirm the custom properties file is regenerated.Screenshot
Stakeholders
@mekarpeles @cdrini @RayBB