简体   繁体   中英

Strange cache behavior with Symfony2

So I'm having a weird problem with Symfony's cache that seems to be triggered by the asset() function.

My template has this line: <link rel="stylesheet" type="text/css" href="{{ asset('public/login/css/layouts.css') }}" />

Changes to this CSS-file will not appear in the browser. I tried to clear browser cache, rm -rf app/cache/* and adding a version number to the link. Nothing did work.

When I change the link by simply removing the asset-function and directly link to the file, I see the changes. Changing the link back will show me the old css-file. What I don't understand is that the HTML-file that is sent to the browser is exactly the same . The link to the CSS-file does not change at all but the content in the CSS-file does change.

You should save your assets in a bundle and let Symfony handle them. After a change, be sure to run:

php app/console assets:install web

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM