Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 {%- if args["module"] -%} | 1 {%- if args["module"] -%} |
kzar
2016/11/18 17:25:48
I went without indentation since it made the rende
| |
2 {%- for module_name, script in modules -%} | 2 {%- for module_name, script in modules -%} |
3 require.modules[{{ module_name|json|safe }}] = function(module, exports, require ) | 3 require.modules[{{ module_name|json }}] = function(module, exports) |
Wladimir Palant
2016/11/30 11:39:32
No point passing in require as parameter, the glob
kzar
2016/11/30 14:29:45
Done.
| |
4 { | 4 { |
5 {{ script|safe }} | 5 {{ script }} |
Wladimir Palant
2016/11/30 11:39:32
Enabling autoescaping and then marking each variab
kzar
2016/11/30 14:29:44
Lol good point, done.
| |
6 return exports; | 6 return module.exports; |
Wladimir Palant
2016/11/30 11:42:14
This should return module.exports, in case the mod
kzar
2016/11/30 14:29:44
Done.
| |
7 }; | 7 }; |
8 | 8 |
9 {% endfor -%} | 9 {% endfor -%} |
10 {% for module_name, script in modules -%} | 10 {%- set modules = dict(modules) -%} |
Wladimir Palant
2016/11/30 11:39:32
This should be {%- for ... -%}, no point adding an
kzar
2016/11/30 14:29:45
Done.
| |
11 {%- if module_name in args["autoload"] -%} | 11 {%- for module_name in args["autoload"] -%} |
Wladimir Palant
2016/11/30 11:39:32
This should not iterate over modules again, rather
kzar
2016/11/30 14:29:44
Done.
| |
12 require({{ module_name|json|safe }}); | 12 {%- if module_name in modules -%} |
13 {% endif -%} | 13 require({{ module_name|json }}); |
14 {%- endfor %} | 14 {% endif %} |
15 {%- endfor -%} | |
15 {%- else -%} | 16 {%- else -%} |
16 {%- for module_name, script in modules -%} | 17 {%- for module_name, script in modules -%} |
17 {{ script|safe }} | 18 {{ script }} |
18 {%- endfor -%} | 19 {% endfor -%} |
19 {% endif %} | 20 {%- endif -%} |
Wladimir Palant
2016/11/30 11:39:32
This should be:
{% endfor -%}
{%- endif -%}
In o
kzar
2016/11/30 14:29:44
Done.
| |
LEFT | RIGHT |