-
Notifications
You must be signed in to change notification settings - Fork 2
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
Background image disappears with Grav's caching turned on #2
Comments
Thanks for this report. So far, the plugin has been tested on the current release series only (Grav 1.6). The plugin uses Grav's asset manager, more specifically its function Would it help in your case if you follow the advice in getgrav/grav#2445 (comment) and set
in the page's frontmatter? |
Yeah, with disabling Twig caching for the page the background image works fine. Thanks 👍 |
The issue appears when background images are used inside a page's content (as opposed to a template). This use case has not been described in the plugin's documentation. Version 3.0.0 now contains a section on how to use a background image in the page's content, describing the |
Update: The problem appears to be caused by Grav failing to correctly deal with Twig caching on modular pages (this is getgrav/grav#1934). In these scenarios, Grav caches a modular page's HTML content, but forgets to cache the CSS (or JS) code generated along with the output by Twig functions. So whether background images are specified in templates or in pages does not matter. What matters is whether a background image appears in a modular page. This has been documented along with a workaround in version 3.0.2 of this plugin. |
Grav 1.7.0 rc. 17
With the Grav's caching turned off background images work fine. When turning the caching on (the regular caching from the admin panel) the background image disappears after being cached (it is visible the first time loading page but disapears after the reload). It appears again only after clearing the cache (until reload when it disappears again) or after turning off the caching completely.
I've found that proper class is preserved but style definition gets deleted from the head of the page.
Didn't try it on stable release of Grav nor with any caching plugins yet.
The text was updated successfully, but these errors were encountered: