3

I am using basic CSS background images and I am running image filters that optimize the images in Symfony2. However, it seems that the URL of the compiled/processed CSS file contains wrong URLs:

url("../../Resources/public/images/gradients-1x210.png") repeat-x scroll 0 -66px transparent

I don't understand why it has transformed my URL from ../images/gradients-1x210.png to that.

I have tried both cssfilter enabled and disabled.

1 Answer 1

1

What is the relative path from /web of your image? Is it in web directory?

You can use absolute paths like /web/images/gradients-1x210.png

Sign up to request clarification or add additional context in comments.

3 Comments

Paths are web/css and web/images, so the images reside relatively like url(../foo.png).
ok. Try cssrewrite. {% stylesheets 'bundles/yourbundle/css/*' filter='cssrewrite' %}{% endstylesheets %} Then run assets:install, dump, and.. pray :) Now Mr Symfony should know the correct relative path of your css and transform it rightly to your /web/bundles path. (I hope)
The problem was that I was using {% stylesheets '@MyProjBundle/Resources/public/css/*' filter='cssrewrite' %}{% endstylesheets %} instead of using bundles/... path. Assetic is broken with those @ paths. However, installing the assets to the web folder all the time is painful, so I keep them under Resources, and I did assets:install --symlink web that symlinks it. It even works on Win 7 if under Administrator.

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.