Gabriel Theron
Gabriel Theron

Reputation: 1376

Symfony2 : cannot load resource "."

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.

Upvotes: 1

Views: 9012

Answers (6)

kristof
kristof

Reputation: 129

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.

Upvotes: 1

blamb
blamb

Reputation: 4289

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.

Upvotes: -1

tirenweb
tirenweb

Reputation: 31709

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

Upvotes: 10

cahn
cahn

Reputation: 1369

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.

Upvotes: 3

SebScoFr
SebScoFr

Reputation: 901

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

Upvotes: 2

Aurel
Aurel

Reputation: 385

Try to run the following commands:

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

Upvotes: 3

Related Questions