abstract class Components::Assets::Asset

Overview

Base class for all assets in the pipeline

Direct Known Subclasses

Defined in:

components/assets/base/asset.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(source_path : String | Nil = nil, content : String = "") #

[View source]

Instance Method Detail

def add_dependency(asset_id : String) : Nil #

Add a dependency


[View source]
def content : String #

Asset content


[View source]
def content=(content : String) #

Asset content


[View source]
abstract def content_type : String #

Abstract method - must be implemented by subclasses


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

Dependencies on other assets


[View source]
def fingerprint : String #

Generate a fingerprint for cache busting


[View source]
def get_metadata(key : String) : String | Nil #

Get metadata


[View source]
def id : String #

Unique identifier for this asset


[View source]
def metadata : Hash(String, String) #

Asset metadata


[View source]
def modified? : Bool #

Check if asset has been modified


[View source]
def output_filename : String #

Get the output filename for this asset


[View source]
abstract def process : String #

Process the asset (compile, optimize, etc.)


[View source]
def processed_content : String #

[View source]
def reload : Nil #

Reload content from source


[View source]
def remove_dependency(asset_id : String) : Nil #

Remove a dependency


[View source]
def set_metadata(key : String, value : String) : Nil #

Set metadata


[View source]
def source_path? : String | Nil #

Source file path (if file-based)


[View source]
def to_h : Hash(String, JSON::Any) #

Convert to hash for serialization


[View source]
def updated_at : Time #

Timestamp for cache invalidation


[View source]