beliveyourdream beliveyourdream - 1 month ago 16
Apache Configuration Question

Symfony Assetic wrong resource type

I have a strange problem with symfony 2. I'm working on a project that has all the stylesheets and javascript files loaded with asset(path/to/file) and i decided to use assetic with cssrewrite and yui_compressor so i added them like this:

// this is just one file for example
{% stylesheets
'bundles/mybundle/css/main.css'
filter='?cssrewrite, ?yui_css'
%}


Now eveything works perfect in prod env but the problem is in the dev environment. The file is linked correct, i can open the file but resource type is actually text/html instead of text/css even though the type is set to text/css like this:

<link rel="stylesheet" type="text/css" href="/app_dev.php/css/ab72c13_main_1.css"/>


What could cause this strange problem?

Answer

I finally found the problem, with the help of @cordoval.

I had two files that configured assetic: use_controller and one of the was overriding the other one with true.

So the solution to this problem is to set assetic: use_controller : false and use assetic:dump --watch to automatically dump the assetic in case you don't want to do that every time you modify a css/js file.

Comments