Skip to content
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

Globs fail to expand properly when ASSETS_DEBUG is True #5

Open
natefaubion opened this issue Dec 19, 2012 · 4 comments
Open

Globs fail to expand properly when ASSETS_DEBUG is True #5

natefaubion opened this issue Dec 19, 2012 · 4 comments

Comments

@natefaubion
Copy link

Create a bundle that uses globs:

js = Bundle('js/*.js')

And say it includes 4 files, the final output will be:

<script src="http://localhost/static/js/*.js"></script>
<script src="http://localhost/static/js/*.js"></script>
<script src="http://localhost/static/js/*.js"></script>
<script src="http://localhost/static/js/*.js"></script>

The problem stems from DjangoResolver#resolve_source_to_url only using the item argument, which is the unexpanded glob pattern, rather then making a url from the filepath argument which is the expanded path.

https://github.com/miracle2k/django-assets/blob/master/django_assets/env.py#L153-L161

I would submit a PR, but I'm not sure of the best way to go around fixing this.

@miracle2k
Copy link
Owner

Ah crap, that's basically the same problem Flask-Assets currently has.

It would certainly be possible to loop through the finder storages, find the right one based on it's base path, and thus calculate it's relative url. But it's a bit unfortunate, since the information is right there when the globbing happens, it just isn't kept. Maybe an update to the Resolver API is called for.

@j0hnsmith
Copy link

I'd love to see this fixed.

@j0hnsmith
Copy link

For those who want to use globs during development, I've found that django-pipeline offers much of the same functionality as django-assets.

@julen
Copy link
Contributor

julen commented Aug 11, 2014

#8 fixes this by the way (not using Resolver APIs though).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants