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
Better document, how to use preload #1032
Comments
This issue closely relate to #690 |
I just realised, that the trick with the templates/compressor/css_preload.html: {% include "./css_file.html" %}
<link rel="preload" href="{{ compressed.url }}" as="style" /> templates/compressor/js_preload.html {% include "./js_file.html" %}
<link rel="preload" href="{{ compressed.url }}" as="script"/> And use the compression as the documentation recommends: {% compress css preload style %}
<link rel="stylesheet" href="{% sass_src 'css/scss/style.scss' %}">
{% endcompress %} I think, that might be the desired content of those templates for most users, but I am not sure about the original intention of the |
the way the feature currently works you have to use the same compress tag twice, see #951 (comment). I agree this needs better documentation. Out of interest, in your solution you're putting the preload tag right before the actual stylesheet/script tag. What's the benefit of that compared to just the script tag? I thought the point of |
@PetrDlouhy @karyon You are both right... I did a poor job with the documentation and I will try to make a PR with an update this week. The intention of the |
@jsumnerPhD Or is there some way to reference the previously generated tag? |
Hi @PetrDlouhy, I think the repetition is somewhat unavoidable given how the preload directive works. The proposed solution essentially re-uses the regular tag generation workflow to ensure that the hash in the preload tag is correct (in fact, that is all that it really does). There may indeed be another way to reference that hash. Cheers, |
The usage of preload from documentation is not working on real websites.
The result html must consist from two tags: the
<link rel="preload">
and the<link rel="stylesheet">
(or script) in order to be preloaded by browser.Working example for me is:
I didn't find out how to get this working with the
preload
type on compress templatetag.I think, this should have clearer explanation in the documentation.
The text was updated successfully, but these errors were encountered: