class Marten::Asset::Engine

Overview

Represents an assets engine.

An assets engine holds a storage to collect, persist and resolve asset URLs, as well as finders to discover the assets to collect.

Defined in:

marten/asset/engine.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(storage : Core::Storage::Base) #

[View source]

Instance Method Detail

def find(filepath : String) : String #

Returns the absolute path corresponding to the passed asset file path.


[View source]
def finders : Array(Marten::Asset::Finder::Base) #

[View source]
def finders=(finders : Array(Marten::Asset::Finder::Base)) #

[View source]
def manifests : Array(String) #

[View source]
def manifests=(manifests : Array(String)) #

[View source]

[View source]
def url(filepath : String) : String #

Returns the URL associated with the passed file name or file path.

If manifests are configured, those will be used in order to try to map the passed filepath to a real file path that is fingerprinted. The passed filepath will be used as is if it is not present in the configured manifests (or if there are no configured manifests at all).


[View source]