View Source PhoenixImportmap.Importmap (Phoenix Importmap v0.4.0)

Provides functions for working with importmaps.

Summary

Functions

Copies importmap assets to :copy_destination_path.

Filters an importmap based on a given asset path.

Encodes an importmap into JSON.

Maps local paths from the configured importmap to the location they are being served from.

Types

t()

@type t() :: %PhoenixImportmap.Importmap{imports: map()}

Functions

copy(importmap)

Copies importmap assets to :copy_destination_path.

filter(importmap, asset_path)

Filters an importmap based on a given asset path.

Used to update only assets that have changed in file watching.

json(importmap)

Encodes an importmap into JSON.

prepare(importmap, endpoint)

Maps local paths from the configured importmap to the location they are being served from.

  • Strips :public_asset_path_prefix from asset paths so they may be resolved by Plug.Static.
  • Uses YourAppWeb.Endpoint.static_path/1 to determine whether to use digest URLs.