|
28 | 28 |
|
29 | 29 | _this_module = _sys.modules[__name__] |
30 | 30 |
|
31 | | - |
32 | | -_js_dist = [ |
33 | | - { |
34 | | - 'relative_package_path': '{{cookiecutter.project_shortname}}.min.js', |
35 | | -{% if cookiecutter.publish_on_npm == 'True' -%} |
36 | | - 'external_url': 'https://unpkg.com/{0}@{2}/{1}/{1}.min.js'.format( |
37 | | - package_name, __name__, __version__), |
38 | | -{%- endif %} |
39 | | - 'namespace': package_name |
40 | | - }, |
41 | | - { |
42 | | - 'relative_package_path': '{{cookiecutter.project_shortname}}.min.js.map', |
43 | | -{% if cookiecutter.publish_on_npm == 'True' -%} |
44 | | - 'external_url': 'https://unpkg.com/{0}@{2}/{1}/{1}.min.js.map'.format( |
45 | | - package_name, __name__, __version__), |
46 | | -{%- endif %} |
47 | | - 'namespace': package_name, |
48 | | - 'dynamic': True |
49 | | - } |
| 31 | +async_resources = [ |
| 32 | + {%- if cookiecutter.use_async == "True" -%} |
| 33 | + "{{cookiecutter.component_name}}", |
| 34 | + {%- endif -%} |
50 | 35 | ] |
51 | 36 |
|
| 37 | +_js_dist = [] |
| 38 | + |
| 39 | +_js_dist.extend( |
| 40 | + [ |
| 41 | + { |
| 42 | + "relative_package_path": "async-{}.js".format(async_resource), |
| 43 | + "external_url": ( |
| 44 | + "https://unpkg.com/{0}@{2}" |
| 45 | + "/{1}/async-{3}.js" |
| 46 | + ).format(package_name, __name__, __version__, async_resource), |
| 47 | + "namespace": package_name, |
| 48 | + "async": True, |
| 49 | + } |
| 50 | + for async_resource in async_resources |
| 51 | + ] |
| 52 | +) |
| 53 | + |
| 54 | +# TODO: Figure out if unpkg link works |
| 55 | +_js_dist.extend( |
| 56 | + [ |
| 57 | + { |
| 58 | + "relative_package_path": "async-{}.js.map".format(async_resource), |
| 59 | + "external_url": ( |
| 60 | + "https://unpkg.com/{0}@{2}" |
| 61 | + "/{1}/async-{3}.js.map" |
| 62 | + ).format(package_name, __name__, __version__, async_resource), |
| 63 | + "namespace": package_name, |
| 64 | + "dynamic": True, |
| 65 | + } |
| 66 | + for async_resource in async_resources |
| 67 | + ] |
| 68 | +) |
| 69 | + |
| 70 | +_js_dist.extend( |
| 71 | + [ |
| 72 | + { |
| 73 | + 'relative_package_path': '{{cookiecutter.project_shortname}}.min.js', |
| 74 | + {% if cookiecutter.publish_on_npm == 'True' -%} |
| 75 | + 'external_url': 'https://unpkg.com/{0}@{2}/{1}/{1}.min.js'.format( |
| 76 | + package_name, __name__, __version__), |
| 77 | + {%- endif %} |
| 78 | + 'namespace': package_name |
| 79 | + }, |
| 80 | + { |
| 81 | + 'relative_package_path': '{{cookiecutter.project_shortname}}.min.js.map', |
| 82 | + {% if cookiecutter.publish_on_npm == 'True' -%} |
| 83 | + 'external_url': 'https://unpkg.com/{0}@{2}/{1}/{1}.min.js.map'.format( |
| 84 | + package_name, __name__, __version__), |
| 85 | + {%- endif %} |
| 86 | + 'namespace': package_name, |
| 87 | + 'dynamic': True |
| 88 | + } |
| 89 | + ] |
| 90 | +) |
| 91 | + |
52 | 92 | _css_dist = [] |
53 | 93 |
|
54 | 94 |
|
|
0 commit comments