-
Notifications
You must be signed in to change notification settings - Fork 619
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
{% js %} / {% script %} inside {% cache %} only works on first page load #7758
Comments
That’s expected; those tags can only capture direct tag output, but |
Sorry about this, I had misunderstood how |
Yeah fair enough. This has come up a few times, so I agree it’s probably not expected behavior, and tricky to debug. Just went ahead and added JS & CSS code caching for |
@brandonkelly Just noticed that caching only works for inline code, not JS / CSS files. Is this by design or is there something stopping this from working correctly? It would be a great improvement if the cache tag worked with the JS / CSS tags when registering files. At least for us, inline code is not used very much, but it's very common to have a component (that may be included in a part of the page that's cached) that needs to register its own JS / CSS files. Not being able to do that inside components that may be cached is a rather hefty limitation. Is there any chance to get this in the future? |
@schwarzdesign It’s doable. Can you please post that as a new feature request? |
@brandonkelly A bit late, but I've opened a discussion regarding this feature request: #9987 |
Description
On a new Craft install, when using either the
{% js %}
or{% script %}
tags inside a{% cache %}
tag, the<script>
is output to a page on the first load, but not on subsequent loads of that page.Steps to reproduce
{% js %}
or{% script %}
tag inside a{% cache %}
tag<script>
tag has been output<script>
tag hasn't been outputAdditional info
The text was updated successfully, but these errors were encountered: