⚡ Bolt: Optimize theme generation and CSS application pipeline - #1
⚡ Bolt: Optimize theme generation and CSS application pipeline#1kai-orion wants to merge 1 commit into
Conversation
This PR introduces several performance improvements to the Material Theme Builder: 1. **Memoized kebab-case conversion**: Added a Map-based cache to `toKebabCase` utility to avoid redundant regex operations when processing dozens of color tokens on every input change. 2. **Constructable Stylesheets**: Refactored the theme application logic to use a singleton `CSSStyleSheet` with `replaceSync`, significantly reducing the overhead of updating document styles compared to re-creating and re-attaching stylesheets. 3. **Optimized CSS string building**: Replaced inefficient `reduce` chains and multiple global `replaceAll` calls with streamlined loops. The new implementation generates both raw CSS for the document and formatted CSS for the code preview in a single pass. 4. **Build stability fixes**: Fixed build failures caused by missing `.js` extensions in `@material/material-color-utilities` and updated `@sandlada/material-design-css` import paths to match the current environment's file structure. These changes make the real-time theme preview feel more responsive, especially when using sliders or color pickers.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Optimized the performance of the theme generation and application pipeline by implementing memoization, using Constructable Stylesheets, and streamlining CSS string building. Also included necessary build stability fixes for the current environment.
PR created automatically by Jules for task 17978286101064239539 started by @kai-orion