]> git.openstreetmap.org Git - rails.git/blob - config/initializers/r2.rb
Merge pull request #2485 from mmd-osm/patch/json2
[rails.git] / config / initializers / r2.rb
1 require "r2"
2
3 class R2ScssProcessor < SassC::Rails::ScssTemplate
4   def self.call(input)
5     output = super(input)
6     data = R2.r2(output[:data])
7     output.delete(:map)
8     output.merge(:data => data)
9   end
10 end
11
12 Rails.application.config.assets.configure do |env|
13   env.register_mime_type "text/r2+scss", :extensions => [".r2.scss"]
14   env.register_transformer "text/r2+scss", "text/css", R2ScssProcessor
15   env.register_preprocessor "text/r2+scss", Sprockets::DirectiveProcessor.new(:comments => ["//", ["/*", "*/"]])
16 end