Sha256: ad3044cc23a0b8a66bd5c4b760c9104c3f0114cf71f41618449f981cfc6d50eb

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

require_relative 'assets'
require_relative 'config'
require_relative 'middleware'
require_relative 'version'

require_relative 'preprocessors/css-preprocessor'
require_relative 'preprocessors/image-preprocessor'
require_relative 'preprocessors/javascript-preprocessor'
require_relative 'preprocessors/sass-preprocessor'

Pakyow::App.after :init do
  config.assets.stores.each_pair do |name, path|
    Pakyow::Assets.register_path_with_name(path, name)
  end

  if config.assets.compile_on_startup
    Pakyow::App.processor :html do |content|
      Pakyow::Assets.mixin_fingerprints(content)
    end

    Pakyow.logger.debug 'Precompiling assets...'
    Pakyow::Assets.precompile
    Pakyow.logger.debug 'Finished precompiling!'
  end
end

# make sure this middleware executes first
# FIXME: need an api for this on Pakyow::App
Pakyow::App.class_variable_get(:@@middleware).unshift(lambda  { |builder|
  builder.use Pakyow::Assets::Middleware
})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pakyow-assets-0.1.1 lib/pakyow-assets.rb