BunBundle.Component (bun_bundle v0.1.1)

Copy Markdown View Source

HEEx components for Phoenix that render fingerprinted asset tags.

This module is only compiled when Phoenix.Component is available. Recompile after adding it.

Usage

# In your layout or template.
<BunBundle.Component.css href="css/app.css" />
<BunBundle.Component.js src="js/app.js" defer />

Or import and drop the module prefix.

import BunBundle.Component

<.css href="css/app.css" />
<.js src="js/app.js" defer />

Summary

Functions

Renders a <link rel="stylesheet"> tag for the given CSS entry.

Renders an <img> tag for the given image asset.

Renders a <script> tag for the given JS entry.

Functions

css(assigns)

Renders a <link rel="stylesheet"> tag for the given CSS entry.

Attributes

  • href (:string) (required)
  • Global attributes are accepted. Supports all globals plus: ["media"].

img(assigns)

Renders an <img> tag for the given image asset.

Attributes

  • src (:string) (required)
  • alt (:string) - Defaults to "".
  • Global attributes are accepted. Supports all globals plus: ["width", "height", "loading", "decoding"].

js(assigns)

Renders a <script> tag for the given JS entry.

Attributes

  • src (:string) (required)
  • Global attributes are accepted. Supports all globals plus: ["async", "defer", "nonce"].