Expresso.IconTransformer (expresso v0.1.0)

Copy Markdown View Source

The Spark transformer of the icons of a deck

It runs one time for each deck module at compile time, after Expresso.PathTransformer, which makes the root option an absolute path. It reads each SVG file of the icons option of the deck through Expresso.DeckFile, so the watch mode renders the deck again after a change to a file. Then it puts the SVG into each icon element and into each node of a tree with the icon option, and it replaces each :icon:name: in the text of a text area and of an item with the SVG.

A file that it cannot read, a file without an svg element and a name that no icon has are errors, which become a Spark.Error.DslError.

Summary

Functions

Run this transformer after the path transformer, which makes the root absolute

Callback implementation for Spark.Dsl.Transformer.before?/1.

Put the SVG of each icon into the elements of the deck

Functions

after?(arg1)

@spec after?(module()) :: boolean()

Run this transformer after the path transformer, which makes the root absolute

after_compile?()

Callback implementation for Spark.Dsl.Transformer.after_compile?/0.

before?(_)

Callback implementation for Spark.Dsl.Transformer.before?/1.

transform(dsl_state)

@spec transform(map()) :: {:ok, map()} | {:error, Spark.Error.DslError.t()}

Put the SVG of each icon into the elements of the deck