Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: templates/modules.js.tmpl

Issue 29363565: Issue 4552 - Drop jshydra dependency (buildtools) (Closed)
Patch Set: Check module exists before auto-loading it Created Nov. 30, 2016, 3:24 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « releaseAutomation.py ('k') | tox.ini » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: templates/modules.js.tmpl
diff --git a/templates/modules.js.tmpl b/templates/modules.js.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..c826d892704589d344ecb9fadb61348ab8448b3b
--- /dev/null
+++ b/templates/modules.js.tmpl
@@ -0,0 +1,20 @@
+{%- if args["module"] -%}
+{%- for module_name, script in modules -%}
+require.modules[{{ module_name|json }}] = function(module, exports)
+{
+{{ script }}
+return module.exports;
+};
+
+{% endfor -%}
+{%- set modules = dict(modules) -%}
+{%- for module_name in args["autoload"] -%}
+{%- if module_name in modules -%}
+require({{ module_name|json }});
+{% endif %}
+{%- endfor -%}
+{%- else -%}
+{%- for module_name, script in modules -%}
+{{ script }}
+{% endfor -%}
+{%- endif -%}
« no previous file with comments | « releaseAutomation.py ('k') | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld