Class: Stasis::Extensions::Assets
- Inherits:
-
Plugin
- Object
- Plugin
- Stasis::Extensions::Assets
- Defined in:
- lib/stasis/extensions/assets.rb
Instance Method Summary collapse
- #assets ⇒ Object
- #before_all ⇒ Object
-
#initialize(stasis) ⇒ Assets
constructor
A new instance of Assets.
- #reset ⇒ Object
- #resolve_path(path, dirpath) ⇒ Object
Constructor Details
#initialize(stasis) ⇒ Assets
Returns a new instance of Assets.
8 9 10 11 |
# File 'lib/stasis/extensions/assets.rb', line 8 def initialize(stasis) @stasis = stasis reset end |
Instance Method Details
#assets ⇒ Object
13 14 15 |
# File 'lib/stasis/extensions/assets.rb', line 13 def assets @assets end |
#before_all ⇒ Object
17 18 19 20 21 |
# File 'lib/stasis/extensions/assets.rb', line 17 def before_all define_helpers fingerprint_assets Stasis::Options.set_template_option 'scss', { asset_resolver: self } end |
#reset ⇒ Object
23 24 25 |
# File 'lib/stasis/extensions/assets.rb', line 23 def reset @assets = {} end |
#resolve_path(path, dirpath) ⇒ Object
27 28 29 30 |
# File 'lib/stasis/extensions/assets.rb', line 27 def resolve_path(path, dirpath) path = File.(path, dirpath).sub("#{@stasis.root}/", '') "/#{assets[path] || path}" end |