class Middleman::CriticalExtension

Public Class Methods

new(app, options_hash={}, &block) click to toggle source
Calls superclass method
# File lib/middleman-critical/extension.rb, line 9
def initialize(app, options_hash={}, &block)
  super
end

Public Instance Methods

after_build(builder) click to toggle source
# File lib/middleman-critical/extension.rb, line 13
def after_build(builder)

  rootPath = app.root
  buildDir = app.config[:build_dir]
  htmlDir = buildDir + File::SEPARATOR + '**' + File::SEPARATOR + '*.html'

  # cssDir = buildDir + File::SEPARATOR + app.config[:css_dir] + File::SEPARATOR + '**' + File::SEPARATOR + '*.css'
  #cssDirs = []

  #Dir.glob(cssDir) do |file|
  #  cssDirs.push(rootPath + File::SEPARATOR + file)
  #end

  Dir.glob(htmlDir) do |file|
    assetPath = rootPath + File::SEPARATOR + file
    file.slice! buildDir + File::SEPARATOR
    %x(#{options.binary} #{assetPath} --base #{buildDir} --htmlTarget #{file} --extract --inline)
  end

end