Skip to content

Commit

Permalink
Fix get_static
Browse files Browse the repository at this point in the history
  • Loading branch information
fjsj committed Dec 1, 2023
1 parent 9941a53 commit a4455d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion webpack_loader/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)


class WebpackLoader(object):
class WebpackLoader:
_assets = {}

def __init__(self, name, config):
Expand Down
11 changes: 5 additions & 6 deletions webpack_loader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ def get_static(asset_name, config='DEFAULT'):
:param config: (optional) the name of the configuration
:return: path to webpack asset as a string
'''
return "{0}{1}".format(
get_loader(config).get_assets().get(
'publicPath', getattr(settings, 'STATIC_URL')
),
asset_name
)
public_path = get_loader(config).get_assets().get('publicPath')
if not public_path or public_path == 'auto':
public_path = getattr(settings, 'STATIC_URL')

return '{0}{1}'.format(public_path, asset_name)

0 comments on commit a4455d6

Please sign in to comment.