PhoenixAssets. Preset
(PhoenixAssets v0.1.0)
View Source
A deterministic composition of PhoenixAssets.Plugin integrations.
A preset is a module that lists integrations; at compile time they are resolved
into an ordered plugin graph and exposed via plugins/0. Because resolution
happens at compile time, a dependency cycle or a missing hard dependency is a
compile error in the preset module.
Example
defmodule MyApp.Assets.Stack do
use PhoenixAssets.Preset
integration PhoenixAssets.SvelteKit
integration PhoenixAssets.Tailwind, entry: "src/app.css"
integration PhoenixAssets.Storybook, port: 6006
integration PhoenixAssets.Electric, shapes: MyApp.Assets.ElectricShapes
integration PhoenixAssets.PubSub, topics: MyApp.Assets.PubSubTopics
integration PhoenixAssets.Localize, locales: ~w(en sv), default_locale: "en"
endplugins/0 returns the resolved {module, opts} list. The built-in
PhoenixAssets.Presets.Svelte is one such preset; its graph begins with the
SvelteKit integration the others build on:
iex> [{first, _opts} | _] = PhoenixAssets.Presets.Svelte.plugins()
iex> first
PhoenixAssets.SvelteKituse PhoenixAssets.Preset
Using this module imports integration/1 and integration/2. It defines
plugins/0 at the end of compilation after resolving dependency and
ordering constraints.
See also
PhoenixAssets.Plugin-- the integration contract.PhoenixAssets.Plugin.Resolver-- the ordering algorithm.
Summary
Functions
Declares an integration (a PhoenixAssets.Plugin module) and its options.
Functions
Declares an integration (a PhoenixAssets.Plugin module) and its options.