Assetic unable to find file

后端 未结 3 1593
天涯浪人
天涯浪人 2021-02-07 16:12

I am trying to link a css file (that lives in a bundle) inside a twig template :

{% stylesheets 
    \'@AcmeFooBundle/Resources/public/css/bootstrap.min.css\' 
%         


        
3条回答
  •  南旧
    南旧 (楼主)
    2021-02-07 16:55

    The following works for me:

    1. Create bundle e.g.:

      php app/console generate:bundle --namespace=Acme/Bundle/BlogBundle --no-interaction
      

      See: Generating a New Bundle Skeleton

    2. Add Assetic imports as the following:

      {% javascripts '@AcmeBlogBundle/Resources/public/js/*' %}
      
      {% endjavascripts %}
      
    3. Add Bundle to assetic config:

      # Assetic Configuration
      assetic:
          ...
          bundles:        ['AcmeBlogBundle']
          ...
      

提交回复
热议问题