0

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.

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

9 Comments

Thanks for your answer, but this didn't change anything. Also my environment is dev. The problem is not to see changes in prod, it's all about seeing them in dev.
assets:install is needed in dev too, but apparently it doesn't help. Do you see your layouts.css file appear in the output of this command?
Nope the layouts.css is not listed in the output. This is because it is not located in the bundle but in /web/public. Might this be the problem?
probably, you must work on files located in public folder. assetic will move them to the web folder when you run the assets:install command. i suggest you read a bit more on assets management: symfony.com/doc/current/cookbook/assetic/asset_management.html
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.