Class: Alula::Plugins::GenericAsset
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Alula::Plugins::GenericAsset
show all
- Defined in:
- lib/alula/plugins/assets.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ GenericAsset
Returns a new instance of GenericAsset.
14
15
16
17
18
19
|
# File 'lib/alula/plugins/assets.rb', line 14
def initialize(tag_name, markup, tokens)
super
/(?<name>\w+)/ =~ markup
@name = "#{name || default}.#{type}"
end
|
Class Method Details
.default(default) ⇒ Object
10
11
12
|
# File 'lib/alula/plugins/assets.rb', line 10
def self.default(default)
define_method(:default) { default }
end
|
.type(type) ⇒ Object
6
7
8
|
# File 'lib/alula/plugins/assets.rb', line 6
def self.type(type)
define_method(:type) { type }
end
|
Instance Method Details
#render(context) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/alula/plugins/assets.rb', line 21
def render(context)
asset_path = context.registers[:site].config["asset_path"]
manifest = context.registers[:site].config["manifest"]
content(File.join(asset_path, manifest.assets[@name]))
end
|