Skip to content

Commit

Permalink
Add the sourcemap route only if they're enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Sep 26, 2013
1 parent 0eb26e8 commit b09d5f0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/opal/rails/engine.rb
Expand Up @@ -27,17 +27,19 @@ class Engine < ::Rails::Engine
config.after_initialize do |app|
require 'opal/rails/haml_filter' if defined?(Haml)

config = app.config
config.opal.each_pair do |key, value|
key = "#{key}="
Opal::Processor.send(key, value) if Opal::Processor.respond_to? key
end

config = app.config
maps_app = Opal::SourceMapServer.new(app.assets)
if config.opal.source_map_enabled
maps_app = Opal::SourceMapServer.new(app.assets)

app.routes.prepend do
mount maps_app => maps_app.prefix
get '/opal_spec' => 'opal_spec#run'
app.routes.prepend do
mount maps_app => maps_app.prefix
get '/opal_spec' => 'opal_spec#run'
end
end
end

Expand Down

0 comments on commit b09d5f0

Please sign in to comment.