Class: Jekyll::Minibundle::MiniBundleBlock

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/jekyll/minibundle/mini_bundle_block.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, type, _tokens) ⇒ MiniBundleBlock

Returns a new instance of MiniBundleBlock.



7
8
9
10
11
12
13
# File 'lib/jekyll/minibundle/mini_bundle_block.rb', line 7

def initialize(tag_name, type, _tokens)
  super
  @type = type.strip.downcase.to_sym
  if @type.empty?
    fail ArgumentError, "No asset type for minibundle block; pass value such as 'css' or 'js' as the argument"
  end
end

Class Method Details

.default_bundle_configObject



23
24
25
26
27
28
29
30
# File 'lib/jekyll/minibundle/mini_bundle_block.rb', line 23

def self.default_bundle_config
  {
    'source_dir'       => '_assets',
    'destination_path' => 'assets/site',
    'assets'           => [],
    'attributes'       => {}
  }
end

Instance Method Details

#render(context) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/jekyll/minibundle/mini_bundle_block.rb', line 15

def render(context)
  site = context.registers.fetch(:site)
  bundle_config = get_current_bundle_config(Compatibility.load_yaml(super), site)
  file = AssetFileRegistry.bundle_file(site, bundle_config)
  file.add_as_static_file_to(site)
  file.destination_path_for_markup
end