WWW vs CRM CSS — performance checklist
Use this when auditing unused CSS, bundle size, and safe cleanup.
Entry points (webpack)
Section titled “Entry points (webpack)”| Bundle | Entry | Notes |
|---|---|---|
| www | client/js/www/www.bundler.js | Pulls www.index.scss → full Bootstrap (bs.scss), FA Pro, Uppy, large www/03-components/_components.scss barrel. Fancyapps Carousel CSS is lazy-loaded by fancy_carousel_controller.js so it isn’t in the global bundle. |
| CRM | client/js/crm/crm.index.js | crm/crm.index.scss → crm/bs.scss (full Bootstrap) + CRM partials |
| Other | wwwHomeStyles, costCalculatorStyles, rpStyles, reports | Separate CSS entries |
Webpack bundle analysis
Section titled “Webpack bundle analysis”Production build with a static treemap report (outputs under tmp/, gitignored). The script uses WEBPACK_OUTPUT_DIR=tmp/webpack-analyze-output so it does not fight the webpack dev server or overwrite public/javascripts/webpack/.
mise exec -- yarn analyze:webpackOpen tmp/webpack-bundle-report.html in a browser after the build finishes. Compiled assets from that run live in tmp/webpack-analyze-output/ (throwaway; not served by Rails).
Lighthouse / PSI
Section titled “Lighthouse / PSI”- unused-css-rules: Often flags Bootstrap and global components that are used on other routes or dynamically; treat as hints, not a delete list.
- Re-run after meaningful CSS changes; compare the same URL and device profile.
Chrome DevTools Coverage
Section titled “Chrome DevTools Coverage”- Record a session on representative pages (homepage, blog, quote builder, key CRM screens).
- Distinguish same-origin stylesheet bytes from third-party widgets.
- Coverage is a session snapshot — not a substitute for route-by-route review.
Bootstrap
Section titled “Bootstrap”- Today both www and CRM use full Bootstrap via
@forward/ barrel SCSS. - Reducing to partial imports is a large change: verify every utility/component class used in views and Stimulus-controlled DOM.
Font Awesome Pro
Section titled “Font Awesome Pro”- Audit which FA families (solid, regular, light, duotone) and icon names are referenced in HTML/ERB/components.
- Removing kit CSS slices or subsets requires matching what the markup actually uses.
Orphan SCSS
Section titled “Orphan SCSS”- Before deleting a file: search for its basename and
@use/@importpaths (rgacrossclient/,app/). - Do not delete shared partials that are only pulled in via index/barrel files unless the whole chain is unused.
PurgeCSS / aggressive tree-shaking
Section titled “PurgeCSS / aggressive tree-shaking”- Not in use for these bundles; turning it on would need safelists for Bootstrap utilities, dynamic classes, and CMS content. Treat as a separate project with full QA.