package cascade
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c303651e043ed8d807d3d6f2c3745233e792ce7c30d562c9717d284e1bf5ac6a
sha512=681847993deabdc3899f62268b3cbc931623abca0413b0e8873e8568ec25a86c4d3db7f7f0e6a6a6bf24dbfdc7df314dae07ae66d49f76f3dd6953a4381bbf54
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.