Sha256: dbcbb562540e2b8f89c00cd3cc8ae957374d6eca7ff1aafa607795ff79780ab3

Contents?: true

Size: 796 Bytes

Versions: 2

Compression:

Stored size: 796 Bytes

Contents

module Less  
  module Rails
    class Railtie < ::Rails::Railtie
      
      module LessContext
        attr_accessor :less_config
      end
      
      config.less = ActiveSupport::OrderedOptions.new
      
      config.less.paths = []
      
      config.before_initialize do |app|
        unless app.config.assets && app.config.assets.enabled
          raise "The less-rails plugin requires the asset pipeline to be enabled."
        end
        require 'less'
        Sprockets::Engines #force autoloading
        Sprockets.register_engine '.less', Less::Rails::LessTemplate
      end
      
      initializer 'less-rails.setup' do |app|
        app.assets.context_class.extend(LessContext)
        app.assets.context_class.less_config = app.config.less
      end
      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
less-rails-2.0.1 lib/less/rails/railtie.rb
less-rails-2.0.0 lib/less/rails/railtie.rb