PhoenixAssetPipeline.HTML.Macros (phoenix_asset_pipeline v2.0.2)

Copy Markdown View Source

HEEx macros for class extraction, class obfuscation, and static minification.

Use this module in Phoenix HTML contexts instead of importing it directly:

use PhoenixAssetPipeline.HTML.Macros

Summary

Functions

Declares a class expression that can be extracted into the asset manifest.

Compiles HEEx with class extraction and static minification.

Functions

class(classes, key \\ :class)

(macro)

Declares a class expression that can be extracted into the asset manifest.

Expressions in functions and templates resolve the current manifest at runtime, so a manifest update does not require recompiling the caller.

At module scope the expression embeds a prepared short class value. The same fixed mapping is reserved when CSS is built, which keeps module attributes and component attribute defaults minified without a second Elixir compilation.

embed_templates(pattern, opts \\ [])

(macro)

Embeds templates using PhoenixAssetPipeline.HTML.Engine for HEEx files.

sigil_H(arg, modifiers)

(macro)

Compiles HEEx with class extraction and static minification.

Use the noformat modifier to skip static HTML minification for a template.