module Amber::Assets

Overview

Runtime access to the build-time static asset manifest.

Asset compilation belongs in the build or deploy step. Amber only reads the resulting manifest while serving requests, so production filesystems can be read-only and request latency never includes asset generation.

Defined in:

amber/assets.cr

Constant Summary

DEFAULT_MANIFEST_PATH = "public/assets/manifest.json"

Class Method Summary

Class Method Detail

def self.configure(*, manifest_path : String = DEFAULT_MANIFEST_PATH) : Nil #

Configures the persisted manifest Amber reads. Relative paths are resolved by the application process, normally from the project root.


[View source]
def self.entry(logical_path : String) : Entry #

[View source]
def self.expected_public_path(logical_path : String, digest : String, public_path : String) : String #

[View source]
def self.integrity(logical_path : String) : String #

[View source]
def self.manifest : Manifest #

[View source]
def self.manifest_path : String #

[View source]
def self.normalize_logical_path(path : String) : String #

[View source]
def self.normalize_public_path(path : String) : String #

[View source]
def self.path(logical_path : String) : String #

[View source]
def self.public_reference?(path : String) : Bool #

[View source]
def self.reload! : Manifest #

Clears the cached manifest. This is useful after an in-process development build and in tests; production applications normally never need it.


[View source]
def self.resolve(path : String) : String #

Absolute, protocol, fragment, and data URLs are already public references and remain unchanged. Other values are strict logical manifest keys.


[View source]