django-js-reverse icon indicating copy to clipboard operation
django-js-reverse copied to clipboard

Support for {% static %}

Open imaia opened this issue 10 years ago • 9 comments

It would be very nice to have support for {% static %}. Any plans?

imaia avatar Mar 07 '16 17:03 imaia

What do you mean by "support for {% static %}"? You can include js_reverse within static by using <script src="{% url js_reverse %}" type="text/javascript"></script>

ierror avatar Mar 07 '16 17:03 ierror

I mean this:

Urls.static('img/something.jpg') // same output as {% static 'img/something.jpg' %}

Why is this useful? I'm using vuejs and I want to use django-js-reverse from withing my vue component templates, which do not have a django template context attached.

imaia avatar Mar 07 '16 18:03 imaia

ATM i don't need such access to my static content, but feel free to fork and add a PR :-)

ierror avatar Mar 07 '16 18:03 ierror

Fair enough. Will do. I think this feature would be quite useful for those using angularjs or vue-router (my case).

imaia avatar Mar 07 '16 18:03 imaia

@imaia Have you done any work on this? I agree that it would be useful.

paulshannon avatar Apr 04 '17 19:04 paulshannon

I'm using vue in my project. I've resolved problem with static files using collectstatic preprocessing phase - each static route found in bundle.js is replaced with a proper path (i'm using ManifestStaticFilesStorage, but you can write your own custom storage)

Valian avatar May 26 '17 16:05 Valian

I did @paulshannon PR on its way.

italomaia avatar May 29 '17 13:05 italomaia

any updates regarding the PR?

ierror avatar Dec 17 '17 18:12 ierror

Not so far. I confess to have forgotten about it.

italomaia avatar Dec 17 '17 20:12 italomaia