Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions webpack_loader/templatetags/webpack_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


@register.simple_tag
def render_bundle(bundle_name, extension=None, config='DEFAULT', attrs=''):
tags = utils.get_as_tags(bundle_name, extension=extension, config=config, attrs=attrs)
def render_bundle(bundle_name, extension=None, config='DEFAULT', attrs='', jsType='text/javascript'):
tags = utils.get_as_tags(bundle_name, extension=extension, config=config, attrs=attrs, jsType=jsType)
return mark_safe('\n'.join(tags))


Expand Down
6 changes: 3 additions & 3 deletions webpack_loader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_files(bundle_name, extension=None, config='DEFAULT'):
return list(_get_bundle(bundle_name, extension, config))


def get_as_tags(bundle_name, extension=None, config='DEFAULT', attrs=''):
def get_as_tags(bundle_name, extension=None, config='DEFAULT', attrs='', jsType='text/javascript'):
'''
Get a list of formatted <script> & <link> tags for the assets in the
named bundle.
Expand All @@ -64,8 +64,8 @@ def get_as_tags(bundle_name, extension=None, config='DEFAULT', attrs=''):
for chunk in bundle:
if chunk['name'].endswith(('.js', '.js.gz')):
tags.append((
'<script type="text/javascript" src="{0}" {1}></script>'
).format(chunk['url'], attrs))
'<script type="{0}" src="{1}" {2}></script>'
).format(jsType, chunk['url'], attrs))
elif chunk['name'].endswith(('.css', '.css.gz')):
tags.append((
'<link type="text/css" href="{0}" rel="stylesheet" {1}/>'
Expand Down