Skip to content

Commit b09d5f0

Browse files
committed
Add the sourcemap route only if they're enabled
1 parent 0eb26e8 commit b09d5f0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/opal/rails/engine.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@ class Engine < ::Rails::Engine
2727
config.after_initialize do |app|
2828
require 'opal/rails/haml_filter' if defined?(Haml)
2929

30+
config = app.config
3031
config.opal.each_pair do |key, value|
3132
key = "#{key}="
3233
Opal::Processor.send(key, value) if Opal::Processor.respond_to? key
3334
end
3435

35-
config = app.config
36-
maps_app = Opal::SourceMapServer.new(app.assets)
36+
if config.opal.source_map_enabled
37+
maps_app = Opal::SourceMapServer.new(app.assets)
3738

38-
app.routes.prepend do
39-
mount maps_app => maps_app.prefix
40-
get '/opal_spec' => 'opal_spec#run'
39+
app.routes.prepend do
40+
mount maps_app => maps_app.prefix
41+
get '/opal_spec' => 'opal_spec#run'
42+
end
4143
end
4244
end
4345

0 commit comments

Comments
 (0)