-
Notifications
You must be signed in to change notification settings - Fork 342
Handle transformed assets URL #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
webpack_loader/utils.py
Outdated
|
|
||
| return '{0}{1}'.format(public_path, asset_name) | ||
|
|
||
| def get_asset(asset_name, config='DEFAULT'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a docstring similar to the one from get_static, but clarify why this is different.
webpack_loader/loaders.py
Outdated
| asset = next((x for x in assets if x.get("sourceFilename") == name), None) | ||
| if not asset: | ||
| asset = next((x for x in assets if x["name"] == name), None) | ||
| return asset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should read like this:
def get_asset_by_source_filename(self, name):
files = self.get_assets()["assets"]
return next((x for x in files if x.get("sourceFilename") == name), None)
fjsj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, but please check suggestions. Thanks for the contribution!
7d52a83 to
889c5b4
Compare
|
@fjsj Thanks for the review! Let me know if all changes fit the requirements |
Adding the following template tag
```
{% webpack_asset 'path/to/original/file' %}
```
Fixes django-webpack#343
Depends on django-webpack/webpack-bundle-tracker#125
889c5b4 to
65dddf2
Compare
fjsj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great.
| "license": "MIT", | ||
| "devDependencies": { | ||
| "webpack": "^5.91.0", | ||
| "webpack-bundle-tracker": "github:hostnfly/webpack-bundle-tracker#assets-source-filenames", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change that after merge.
|
Released at 3.1.0, thanks again @batistadasilva |
Adding the following template tag
Fixes #343
Depends on django-webpack/webpack-bundle-tracker#125