Class: Jekyll::Minibundle::AssetBundle

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/minibundle/asset_bundle.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, assets, site_dir) ⇒ AssetBundle

Returns a new instance of AssetBundle.



6
7
8
9
10
# File 'lib/jekyll/minibundle/asset_bundle.rb', line 6

def initialize(type, assets, site_dir)
  @type, @assets, @site_dir = type, assets, site_dir
  @temp_file = Tempfile.new "jekyll-minibundle-#{@type}-"
  at_exit { @temp_file.close! }
end

Instance Method Details

#make_bundleObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jekyll/minibundle/asset_bundle.rb', line 16

def make_bundle
  pipe_bundling_to_temp_file bundling_cmd do |wr|
    $stdout.puts  # place newline after "(Re)generating..." log messages
    log "Bundling #{@type} assets:"
    @assets.each do |asset|
      log asset
      IO.foreach(asset) { |line| wr.write line }
      wr.puts ';' if @type == :js
    end
  end
  self
end

#pathObject



12
13
14
# File 'lib/jekyll/minibundle/asset_bundle.rb', line 12

def path
  @temp_file.path
end