1
votes

I read this and this

I want to simply include stylesheets with assetic in my template. I want to keep all css files in the bundle public dir. Not in any app/ dir from another dir tree.

My webroot to the bundle CSS tree: [webroot]/src/Myvendor/MyBundle/Resources/public/css/

So i took this example

{# base.html.twig #}
{% stylesheets 'bundles/app/css/*' filter='cssrewrite' %}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

Naturally this did not work with the example path on me, so i tried to insert my path. I dont want to make use of @MyvendorMyBundle/Resources/public/js/* due to the fact of the cssrewrite problems. But making use of this path, the css is going to be taken.

So i tried every relative constellation of my css path. And no one worked..

  • src/Myvendor/MyBundle/Resources/public/css/*
  • src/MyvendorMyBundle/Resources/public/css/*
  • Myvendor/MyBundle/Resources/public/css/*
  • MyvendorMyBundle/Resources/public/css/*
  • MyBundle/Resources/public/css/*
  • Resources/public/css/*
  • public/css/*
  • css/*
  • bundles/app/css/*
  • bundles/Myvendor/MyBundle/Resources/public/css/*
  • bundles/MyvendorMyBundle/Resources/public/css/*
  • bundles/MyBundle/Resources/public/css/*
  • bundles/Resources/public/css/*
  • bundles/public/css/*
  • ../public/css/*

I really googled and found only examples that did not work for me, and they seems that they were all in the /app/Resources/foo... but i dont want this, it must stay in the bundle.

What im doing wrong? Thanks in advice.

1

1 Answers

3
votes

Well, if you don't move your stylesheet anywhere it is in src/Easylearn/QuerybuildBundle/Resources/public/css/. However, when using relative paths, they are relative to the web/ directory. So do ../src/Easylearn/QuerybuildBundle/Resources/public/css/.

I'm not sure actually why you don't set-up a symlink from all public/ directories in bundles to web/bundles (by running app/console assets:install --symlink).