@@ -5,7 +5,7 @@ def _requirejs_data(name, &block)
5
5
{ } . tap do |data |
6
6
if name
7
7
name += ".js" unless name =~ /\. js$/
8
- data [ 'main' ] = javascript_path ( name )
8
+ data [ 'main' ] = _javascript_path ( name )
9
9
end
10
10
11
11
data . merge! ( yield controller ) if block_given?
@@ -17,7 +17,7 @@ def _requirejs_data(name, &block)
17
17
def _data_main ( name )
18
18
if name
19
19
name += ".js" unless name =~ /\. js$/
20
- %Q{data-main="#{ javascript_path ( name ) } "}
20
+ %Q{data-main="#{ _javascript_path ( name ) } "}
21
21
else
22
22
""
23
23
end
@@ -41,7 +41,7 @@ def requirejs_include_tag(name=nil, &block)
41
41
42
42
# Generate digestified paths from the modules spec
43
43
paths = { }
44
- modules . each { |m | paths [ m ] = javascript_path ( m ) . sub /\. js$/ , '' }
44
+ modules . each { |m | paths [ m ] = _javascript_path ( m ) . sub /\. js$/ , '' }
45
45
46
46
# Override uesr paths, whose mappings are only relevant in dev mode
47
47
# and in the build_config.
@@ -53,7 +53,7 @@ def requirejs_include_tag(name=nil, &block)
53
53
end
54
54
55
55
html . concat <<-HTML
56
- < script #{ _requirejs_data ( name , &block ) } src="#{ javascript_path 'require.js' } "> </ script>
56
+ < script #{ _requirejs_data ( name , &block ) } src="#{ _javascript_path 'require.js' } "> </ script>
57
57
HTML
58
58
59
59
html . html_safe
@@ -72,6 +72,14 @@ def _once_guard
72
72
end
73
73
74
74
def _almond_include_tag ( name , &block )
75
- "<script src='#{ javascript_path name } '></script>\n " . html_safe
75
+ "<script src='#{ _javascript_path name } '></script>\n " . html_safe
76
+ end
77
+
78
+ def _javascript_path ( name )
79
+ if defined? ( javascript_path )
80
+ javascript_path ( name )
81
+ else
82
+ "/assets/#{ name } "
83
+ end
76
84
end
77
85
end
0 commit comments