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

Commit ad87f76

Browse files
committed
Fix almond build
1 parent a2db510 commit ad87f76

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/requirejs/rails/rjs_driver.js.erb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ cdn_pattern = Regexp.new("\\Ahttps?://")
44

55
modifiedHash = build_config.select { |k, _| k != "modules" }
66
pathsHash = modifiedHash["paths"]
7-
modifiedHash["dir"] = build_dir.to_s
7+
8+
case loader
9+
when :requirejs
10+
modifiedHash['dir'] = build_dir.to_s
11+
when :almond
12+
almond_module = build_config['modules'][0]
13+
modifiedHash.merge!(almond_module)
14+
modifiedHash['out'] = build_dir + (module_name_for(almond_module) + '.js')
15+
end
16+
817
modifiedHash["paths"] = Hash[
918
pathsHash.map do |k, v|
1019
[k, v.is_a?(Array) || cdn_pattern.match(v) ? "empty:" : v]
@@ -14,10 +23,12 @@ modifiedHash["paths"] = Hash[
1423
JSON.pretty_generate(modifiedHash)
1524
%>;
1625

26+
<% unless loader == :almond %>
1727
baseConfig.modules = [
1828
<% build_config["modules"].each do |m| %>
1929
<%= JSON.pretty_generate(m) %>,
2030
<% end %>
2131
];
32+
<% end %>
2233

2334
requirejs.optimize(baseConfig);

0 commit comments

Comments
 (0)