Performance: Production vs development builds
This affects the CSS file size and how quickly styles are applied during page load.
Jump into concepts and practice - no test required
sass styles.scss styles.css --style compressed --no-source-map
sass --watch styles.scss styles.css --style expanded --source-map
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Development build (expanded, with source maps) | No change | No change | Higher due to delayed style application | [X] Bad |
| Production build (compressed, no source maps) | No change | No change | Lower due to faster style application | [OK] Good |
expanded style in Sass during development?expanded styleexpanded style formats CSS with indentation and line breaks, making it easy to read.style.scss into compressed CSS for production?--style=compressed option tells Sass to minify CSS for production.expanded is for readable CSS, --watch watches files but doesn't set style, nested is another readable format.sass input.scss output.css --style=compressed
compressed style removes spaces and line breaks to minimize file size.sass style.scss style.css --style=compressed but the output CSS is still very large and readable. What is the likely cause?--style=compressed and file is saved, caching is the likely issue.expanded to compressed reduces file size for faster loading.