Skip to content

Commit 8c68597

Browse files
committed
Updated paths
1 parent b7a7660 commit 8c68597

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

webpack_loader/templatetags/webpack_loader.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ def render_bundle(bundle_name):
1212
bundle = get_bundle(bundle_name)
1313
tags = []
1414
for chunk in bundle:
15+
1516
if chunk['name'].endswith('.js'):
16-
tags.append('<script type="text/javascript" src="{}"/>'.format(chunk['publicPath']))
17+
url = chunk.get('publicPath') or chunk['url']
18+
tags.append('<script type="text/javascript" src="{}"/>'.format(url))
1719
elif chunk['name'].endwith('.css'):
18-
tags.append('<link type="text/css" href="{}" rel="stylesheet"/>'.format(chunk['publicPath']))
20+
tags.append('<link type="text/css" href="{}" rel="stylesheet"/>'.format(url))
1921
return '\n'.join(tags)

webpack_loader/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
from django.conf import settings
55

6-
static_path = getattr(settings, 'WEBPACK_BUNDLE_PATH', 'webpack_bundles/')
7-
stats_file = getattr(settings, 'WEBPACK_STATS_FILE', 'webpack-stats.json')
6+
bundle_url = getattr(settings, 'WEBPACK_BUNDLE_URL', 'webpack_bundles/')
7+
stats_file = getattr(settings, 'WEBPACK_STATS_FILE_PATH', 'webpack-stats.json')
88

99

1010
__all__ = ('get_bundle',)
@@ -32,8 +32,7 @@ def get_bundle(bundle_name):
3232
if assets.get('status') == 'done':
3333
bundle = assets['chunks'][bundle_name]
3434
for F in bundle:
35-
F['url'] = '{}{}'.format(static_path, F['name'])
36-
print bundle
35+
F['url'] = '{}{}'.format(bundle_url, F['name'])
3736
return bundle
3837

3938
elif assets.get('status') == 'error':

0 commit comments

Comments
 (0)