package cascade
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c11bbdc7ab0eee8c03cd162e3e7fd1cb20de62beb13342b3b150a89264ee0056
sha512=43fd97a55c3b1dc4db5c87aa1a5a047d902e902ab2064af3a7c5bf945ebc333f8cd90ecca8013c17be5b950498eace8e0094ee4319eba408285e2bec8d7cdf7b
doc/cascade/Cascade/Inline/index.html
Module Cascade.InlineSource
Closed-world inlining transforms.
Lives one layer above Context: drives the typed-evaluator primitives (Context.eval, custom-property lookup) and threads scope through the AST. Both transforms assume a closed world (no runtime mutation, full file resolution).
vars ?keep_vars ?warn stylesheet substitutes var(--name) references with the value of the corresponding --name declaration and deletes the definition, but only for a variable with a single definition (its value is then unambiguous). A variable in keep_vars, or one redefined in a different scope (a real cascade override such as dark mode), keeps its definition and stays a live var() reference. warn is called with each name (leading --) that could not be inlined because it is redefined in a different scope.
decode_import_url s strips the url(...) wrapper and any surrounding quotes from an @import URL string as held in Stylesheet.import_rule.url. The parser preserves the verbatim source form there for round-tripping; this helper recovers the bare URL.
val imports :
?query:Context.query ->
?layer_order:string list ->
Context.loader ->
Stylesheet.t ->
Stylesheet.timports ?query ?layer_order loader stylesheet replaces every @import rule in stylesheet with the body of the imported stylesheet looked up through loader. Imports the loader cannot resolve are left in place; a cyclic @import is broken by dropping the second visit. The walk descends into nested at-rules and rule bodies, so imports declared inside them are inlined too; the caller is responsible for preloading loader.imports with every transitively-referenced stylesheet body.