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

Add option to output url #1042

Open
thenewguy opened this issue Feb 7, 2021 · 1 comment
Open

Add option to output url #1042

thenewguy opened this issue Feb 7, 2021 · 1 comment

Comments

@thenewguy
Copy link
Contributor

It would be handy for an additional output option that simply returns the compressed file url. This would allow javascript that expects a string url for lazy loading when needed at runtime.

@ideallical
Copy link

Yes, I experience the same issue.

A use case I found myself was to only load a script based on given consent:

{% compress js %}
        <script data-privacy-src="{% static 'vendor/vwo/vwo.js' %}" data-privacy-category="marketing"></script>
{% endcompress %}

I'd want a way to output:

<script data-privacy-src="/static/CACHE/js/output.1f96a412198e.js" data-privacy-category="marketing"></script>

Instead of:

<script src="/static/CACHE/js/output.1f96a412198e.js" type="text/javascript"></script> (and then rendering `;` in the js file)

Creating a custom COMPRESS_PRECOMPILER seems a bit complex here.

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

2 participants