Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 859563d

Browse files
committed
Fix for empty 'paths' config with digested assets
1 parent f5a5b95 commit 859563d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/helpers/requirejs_helper.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ def requirejs_include_tag(name=nil, &block)
5454
paths = {}
5555
modules.each { |m| paths[m] = _javascript_path(m).sub /\.js$/,'' }
5656

57-
# Add paths for assets specified by full URL (on a CDN)
58-
run_config['paths'].each { |k,v| paths[k] = v if v =~ /^https?:/ }
57+
if run_config.has_key? 'paths'
58+
# Add paths for assets specified by full URL (on a CDN)
59+
run_config['paths'].each { |k,v| paths[k] = v if v =~ /^https?:/ }
60+
end
5961

6062
# Override user paths, whose mappings are only relevant in dev mode
6163
# and in the build_config.

test/requirejs-rails_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def wrap(tag)
174174
Rails.application.config.assets.digest = true
175175
Rails.application.config.requirejs.user_config = { 'modules' => [{'name' => 'foo'}] }
176176
render :text => wrap(requirejs_include_tag)
177-
assert_select "script:first-of-type", :text => %r{var require =.*paths.*http://ajax}
177+
assert_select "script:first-of-type", :text => %r[var require =.*"paths":{"foo":"/javascripts/foo"}]
178178
ensure
179179
Rails.application.config.assets.digest = saved_digest
180180
end

0 commit comments

Comments
 (0)