charge
Types
pub type HTMLFile {
HTMLFile(
source: option.Option(@internal Path),
path: @internal SitePath,
html: element.ElementTree,
)
}
Constructors
-
HTMLFile( source: option.Option(@internal Path), path: @internal SitePath, html: element.ElementTree, )
Values
pub fn asset_to_readable_string(asset: Asset) -> String
pub fn assets_to_readable_string(assets: List(Asset)) -> String
pub fn derived_html_file(
source: @internal Path,
path: @internal SitePath,
rendered: element.ElementTree,
) -> Asset
pub fn generated_html_file(
path: @internal SitePath,
rendered: element.ElementTree,
) -> Asset
pub fn loaded(
pages pages: List(page),
aggregate aggregate: aggregate,
) -> Loaded(page, aggregate)
pub fn new(
out out_dir: @internal Path,
load load: fn() -> Result(
Loaded(state, aggregate),
error.ChargeError,
),
render render: fn(List(state), aggregate) -> Result(
List(Asset),
error.ChargeError,
),
) -> Pipeline(state, aggregate)
pub fn run(
pipeline: Pipeline(page, aggregate),
) -> promise.Promise(Result(List(Asset), error.ChargeError))
Cleans the output directory and runs the pipeline
pub fn with(
from: Pipeline(page, aggregate),
render: fn(aggregate) -> Result(List(Asset), error.ChargeError),
) -> Pipeline(page, aggregate)
pub fn with_asset(
from: Pipeline(page, aggregate),
render: fn(aggregate) -> Result(Asset, error.ChargeError),
) -> Pipeline(page, aggregate)
Derive an asset from the pipeline aggregate
pub fn with_assets(
from: Pipeline(page, aggregate),
render: fn(aggregate) -> Result(List(Asset), error.ChargeError),
) -> Pipeline(page, aggregate)
Derive some assets from the pipeline aggregate
pub fn with_async(
from: Pipeline(page, aggregate),
render: fn(aggregate) -> promise.Promise(
Result(List(Asset), error.ChargeError),
),
) -> Pipeline(page, aggregate)
The raw unit for composing sync rendering pipelines
pub fn with_async_component(
from: Pipeline(state, aggregate),
comp: #(
String,
fn(component.RenderData, element.ElementTree) -> promise.Promise(
Result(element.ElementTree, error.ChargeError),
),
),
) -> Pipeline(state, aggregate)
pub fn with_components(
from: Pipeline(page, aggregate),
comps: List(
#(
String,
fn(component.RenderData, element.ElementTree) -> Result(
element.ElementTree,
error.ChargeError,
),
),
),
) -> Pipeline(page, aggregate)
Add server-side components to the pipeline
pub fn with_derived_assets(
from: Pipeline(page, aggregate),
extract: fn(Asset) -> Result(List(Asset), error.ChargeError),
) -> Pipeline(page, aggregate)
Add assets that are derived from an existing asset, e.g. providing an alternate of each page
pub fn with_static_dir(
pipeline: Pipeline(page, aggregate),
dir: @internal Path,
) -> Pipeline(page, aggregate)
Add a static directory to be copied as part of the pipeline
pub fn with_summary(
from: Pipeline(state, aggregate),
summarize: fn(List(Asset), aggregate) -> Result(
List(Asset),
error.ChargeError,
),
) -> Pipeline(state, aggregate)
Add some generic tasks into the pipeline given all the assets rendered till this point as well as the relevant aggregate e.g. running creating an accessibility report on all generated html pages, creating an RSS Feed, etc.