Phlex.StyleCapsule (phlex v0.3.0)

Copy Markdown View Source

Integration helper for using StyleCapsule with Phlex components.

This module provides utilities to integrate StyleCapsule CSS scoping with Phlex components.

Note: This requires the style_capsule package to be installed. Add it to your dependencies:

{:style_capsule, "~> 0.5"}

Summary

Functions

Adds data-capsule attribute to a state's attributes list.

Generates a capsule ID for a component module.

Generates a style tag with scoped CSS.

Wraps HTML content with a capsule element.

Functions

add_capsule_attr(attrs, module)

Adds data-capsule attribute to a state's attributes list.

capsule_id(module)

Generates a capsule ID for a component module.

scope_css(css, module_or_capsule_id, opts \\ [])

Scopes CSS for a component.

style_tag(css, module_or_capsule_id, opts \\ [])

Generates a style tag with scoped CSS.

wrap(html, module_or_capsule_id, opts \\ [])

Wraps HTML content with a capsule element.