Skip to content

Commit a4455d6

Browse files
committed
Fix get_static
1 parent 9941a53 commit a4455d6

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

webpack_loader/loaders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
)
1515

1616

17-
class WebpackLoader(object):
17+
class WebpackLoader:
1818
_assets = {}
1919

2020
def __init__(self, name, config):

webpack_loader/utils.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ def get_static(asset_name, config='DEFAULT'):
105105
:param config: (optional) the name of the configuration
106106
:return: path to webpack asset as a string
107107
'''
108-
return "{0}{1}".format(
109-
get_loader(config).get_assets().get(
110-
'publicPath', getattr(settings, 'STATIC_URL')
111-
),
112-
asset_name
113-
)
108+
public_path = get_loader(config).get_assets().get('publicPath')
109+
if not public_path or public_path == 'auto':
110+
public_path = getattr(settings, 'STATIC_URL')
111+
112+
return '{0}{1}'.format(public_path, asset_name)

0 commit comments

Comments
 (0)