sketch/css
Types
Definition of a StyleSheet. classes
ensures a mapping between functions
and class names. content
is the corresponding CSS classes.
pub type Css {
Css(classes: List(#(String, String)), content: List(String))
}
Constructors
-
Css(classes: List(#(String, String)), content: List(String))
Definition of a Gleam styles definitions file. path
is up to you, to
retrieve your module easily. content
should be a valid Gleam source file.
pub type Module {
Module(
path: String,
content: String,
ast: Option(glance.Module),
)
}
Constructors
-
Module(path: String, content: String, ast: Option(glance.Module))
Functions
pub fn compute_modules(
modules: List(Module),
) -> List(#(Module, Css))
Compute the content of a bunch of Gleam Styles modules. This function is designed to be used outside of the CLI, if you need it in your frontend for example.
pub fn generate_stylesheets(
src src: String,
dst dst: String,
interface src_interfaces: String,
) -> Result(Nil, Error)
Generate stylesheets from Gleam style definitions files. Recursively extract
all files ending with _styles.gleam
, _css.gleam
or _sketch.gleam
to
proper stylesheets, and output some files interfaces to interact with them.
src
should be a relative path containing the source files.
dst
should be a relative path where to output CSS files.
interface
should be a relative path where to output Gleam files.