1

I'm having an issue with assets management in Symfony2. I keep getting the following error :

Cannot load resource ".". 

I've been trying to fix it in my config and routing files for dev environment, but the only thing I really did was changing the use_controller to false in the config_dev.yml file.

I keep summoning my resources in my templates with

{% stylesheets '@MyBundle/Resources/public/css/style.css'
                            filter='cssrewrite' %}
        <link rel="stylesheet" href="{{ asset_url }}" type="text/css" />
{% endstylesheets %} 

and I keep getting the exception :

Cannot load resource ".". 

Any tips on what could go wrong? (I've cleared the cache several times)

Thanks in advance

Edit :

I've tried removing :

_assetic:
    resource: .
    type:     assetic

from my routing_dev.yml file, and the error disappears (with, of course, the resources in my page)

Reedit :

After a complete reinstallation, it seems to be working again. Probably some property I had changed unvoluntarily... Case closed.

6 Answers 6

10

In my case it was related to LiipImagineBundle, I had these lines at my Proyect/FrontendBundle/Resources/config/routing.yml file:

_imagine:
    resource: .
    type:     imagine
Sign up to request clarification or add additional context in comments.

1 Comment

Could you mention what to do with these lines? I have the same error and was able to fix it by deleting these lines. But I can't speak for the masses.
3

Try to run the following commands:

php app/console assets:install web
php app/console assetic:dump

2 Comments

I tried but I'm getting the same error. I'm currently installing a new Symf to see if that changes anything...
not helpful, the problem stems from bad entry in routing.yml file
3

In my case, I had an entry in routing.yml for an package I removed from AppKernel.php. After I removed the routing entry, the error was gone.

Comments

2

I remember having a similar issue some times ago, try to add this line in /app/config/config_dev.yml:

assetic: 
    use_controller: true

Then clean your cache:

php app/console cache:clear

Then:

php app/console assets:install web

2 Comments

Thanks for the tips. As I said in my edited post, I reinstalled Symfony and it's working now.
if you want to use use_controller false then dont follow this suggestion, check your routing files.
1

I had the same issue. In my routing.yml was the following:

api:
    resource: "."
    type:     "api"
    prefix: "/api"

After removing these lines, the issue was fixed.

Comments

-1

Check your assetic configuration, if your going to use

assetic:  
    use_controller: false 

Then check your routing file, comment out the lines

_assetic:
    resource: .
    type:     assetic

That routing entry is not needed when not using assetic's auto compiling.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.