I've downloaded the Lightning Design System Zip and then used styles/salesforce-lightning-design-system.css
(plus the minified version) as part of an external application that is nested within Salesforce. That works well, except now I need to support the option for the Compact Density UI.
From what I can determine this compact UI is achieved via Design Tokens that are defined as variables for a CSS preprocessor such as Sass or Less.
How can I create a static CSS file that represents the compact display UI?
I can see the design system in GitHub along with some example commands to compile "Sass to CSS". Playing with the Compilation steps I got as far as npm run gulp -- styles
. That generated an assets > styles directory with a range of css files, but none of them seemed applicable for a compact UI.
Is it just a matter of giving it the correct parameters to generate the output with the correct design tokens applied?
In examining the actual Salesforce UI it appears they apply the compact UI via CSS variables defined in the root and the var()
function.
I've also asked this question in the Design Trailblazers group.