Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Forked from metaskills/hacks.rb
Created November 15, 2011 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowboyd/1368408 to your computer and use it in GitHub Desktop.
Save cowboyd/1368408 to your computer and use it in GitHub Desktop.
Failed ImportProcessor
module Less
module Rails
class ImportProcessor < Tilt::Template
IMPORT_SCANNER = /@import\s*['"]([^'"]+)['"]\s*;/.freeze
def prepare
end
def evaluate(context, locals, &block)
import_paths = data.scan(IMPORT_SCANNER).flatten.compact.uniq
import_paths.each do |path|
context.depend_on(path)
end
data
end
end
end
end
it 'must register our import processor' do
dummy_assets.bundle_processors['text/css'].must_include Less::Rails::ImportProcessor
end
initializer 'less-rails.before.load_config_initializers', :before => 'load_config_initializers', :group => :all do |app|
raise 'The less-rails plugin requires the asset pipeline to be enabled.' unless app.config.assets.enabled
app.assets.register_bundle_processor 'text/css', ImportProcessor
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment