Implements preload option for scripts
This commit is contained in:
parent
ae7d5b86f6
commit
4d87836df6
1 changed files with 8 additions and 3 deletions
|
@ -62,9 +62,14 @@ def get_as_tags(bundle_name, extension=None, config='DEFAULT', attrs='', is_prel
|
|||
tags = []
|
||||
for chunk in bundle:
|
||||
if chunk['name'].endswith(('.js', '.js.gz')):
|
||||
tags.append((
|
||||
'<script src="{0}" {1}></script>'
|
||||
).format(chunk['url'], attrs))
|
||||
if is_preload:
|
||||
tags.append((
|
||||
'<link rel="preload" as="script" href="{0}" {1}/>'
|
||||
).format(chunk['url'], attrs))
|
||||
else:
|
||||
tags.append((
|
||||
'<script src="{0}" {1}></script>'
|
||||
).format(chunk['url'], attrs))
|
||||
elif chunk['name'].endswith(('.css', '.css.gz')):
|
||||
tags.append((
|
||||
'<link href="{0}" rel={2} {1}/>'
|
||||
|
|
Loading…
Reference in a new issue