2

Is it possible to put a stylesheet in a centralised location? I think putting a css file in the web/bundles/BundleName/css directory is not a good idea, if it is a global stylesheet that I wish for all bundles to use (ie. by including it in base.html.twig).

What do I need to do in order to put a stylesheet in a location where it can logically and easily be used by different bundles?

b85411
  • 9,420
  • 15
  • 65
  • 119

1 Answers1

1

You can simply put it in

/web/css

and link them like this without assetic

<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}"/>

The negative sideeffect is, that you can not use the benefits of assetic like minification or uglification.


The more correct solution would be to place them in app/Resources/Public which is described here Symfony2: How to share js libs and css between bundles

Community
  • 1
  • 1
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
  • Thanks for your reply. If I want to put the css files in app/Resources/public/css/ (to maintain the same sort of structure that exists for base.html.twig) how will I reference those css files from base.html.twig? – b85411 Dec 17 '13 at 02:13
  • @b85411 it is described in http://stackoverflow.com/questions/11192568/symfony2-how-to-share-js-libs-and-css-between-bundles – DarkLeafyGreen Dec 17 '13 at 08:40