LiveStyle.Compiler.CSS (LiveStyle v0.12.0)
View SourceCSS compilation from LiveStyle manifest.
This is an internal module responsible for compiling the final CSS output from the manifest. You typically don't use this module directly.
Generated CSS Structure
The CSS output includes (in order, matching StyleX):
- @property rules - For typed CSS variables
- @property rules - For dynamic CSS variables (with
inherits: false) - @keyframes animations - With RTL variants when needed
- CSS custom properties -
:root { --var: value; } - @position-try rules - For CSS Anchor Positioning
- View transition rules -
::view-transition-*pseudo-elements - Atomic style rules - Sorted by priority, with RTL overrides
- Theme override rules -
.theme-class { --var: override; }
Extending the Pipeline
Add custom plugins via configuration:
config :live_style,
css_plugins: [
{250, MyAppWeb.CSS.CustomPlugin}
]See LiveStyle.Compiler.CSS.Plugin for details.
Configuration
CSS output can be configured via LiveStyle.Config:
use_css_layers: true- Group rules by priority in@layer priorityNblocks (StyleXuseLayers: true)use_css_layers: false(default) - Use:not(#\#)selector hack (StyleX default)
Writing CSS
Use the mix tasks (mix live_style or mix compile.live_style) to generate CSS files.
Summary
Functions
Compiles complete CSS from the manifest.
Expands selectors to include vendor-prefixed variants.
Writes CSS to a file if it has changed.
Functions
@spec compile(LiveStyle.Manifest.t()) :: String.t()
Compiles complete CSS from the manifest.
Runs all registered plugins in priority order and joins their output.
Expands selectors to include vendor-prefixed variants.
Delegates to LiveStyle.Selector.Prefixer.prefix/1.
See LiveStyle.Selector.Prefixer for the full list of supported selectors.
Writes CSS to a file if it has changed.
Delegates to LiveStyle.Compiler.CSS.Writer.write/2.