Drew Landgrave
Drew Landgrave

Reputation: 1625

Assetic/Twig: An exception has been thrown during the compilation of a template (Unable to find file)

I am moving a Symfony2 project to a dev server and a twig is having trouble finding the stylesheets. It finds the stylesheets on my local machine (MacBook Pro OS X).

The following works:

php app/console assest:install
php app/console assetic:dump
php app/console cache:clear

I'm using Assetic to serve up my assets and have used the following format:

{# app/Resources/views/Foo.html.twig #}
{% block stylesheets%}
   {%  stylesheets
      filter='lessphp,cssrewrite'
      '@FooBundle/Resources/public/css/foo/Bar.less'
      '@FooBundle/Resources/public/js/twitter-bootstrap/less/bootstrap.less'
      '@FooBundle/Resources/public/js/twitter-bootstrap/less/responsive.less'
      output= 'css/main.css'
    %}

    <link href="{{ asset_url }}" 
       type='text/css' rel="stylesheet" media='screen'/>

    {% endstylesheets %}
{% endblock %}

But when I load it up on the server I get an error:

An exception has been thrown during the compilation of a template 
("Unable to find file "@FooBundle/Resources/public/css/foo/Bar.less".")
in "::Foo.html.twig".

The process is stopping at the first asset. The server is a Linux x63 EL5 box running PHP 5.4.

What causes this exception? Why can't it find the stylesheet?

Upvotes: 2

Views: 5279

Answers (1)

Drew Landgrave
Drew Landgrave

Reputation: 1625

There was a letter case situation where we had a lowercase letter where there should have been a capital letter.

So for the example, foo should have been Foo:

@FooBundle/Resources/public/css/foo/Bar.less

Should have been:

@FooBundle/Resources/public/css/Foo/Bar.less

Upvotes: 1

Related Questions