Class: Jekyll::Minibundle::MiniStampTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Minibundle::MiniStampTag
- Defined in:
- lib/jekyll/minibundle/mini_stamp_tag.rb
Instance Method Summary collapse
-
#initialize(tag_name, text, _tokens) ⇒ MiniStampTag
constructor
A new instance of MiniStampTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, text, _tokens) ⇒ MiniStampTag
Returns a new instance of MiniStampTag.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/jekyll/minibundle/mini_stamp_tag.rb', line 5 def initialize(tag_name, text, _tokens) super @source_path, destination_path = text.split(/\s+/, 3)[0, 2] if !@source_path || @source_path.empty? raise ArgumentError, "No asset source for ministamp tag; pass value such as '_assets/site.css' as the first argument" end if !destination_path || destination_path.empty? raise ArgumentError, "No asset destination for ministamp tag; pass value such as 'assets/site.css' as the second argument" end @baseurl, @destination_path = normalize_destination_path(destination_path) end |
Instance Method Details
#render(context) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jekyll/minibundle/mini_stamp_tag.rb', line 21 def render(context) site = context.registers.fetch(:site) file = if Environment.development?(site) AssetFileRegistry.register_development_file(site, @source_path, @destination_path) else AssetFileRegistry.register_stamp_file(site, @source_path, @destination_path) end @baseurl + file.destination_path_for_markup end |