b85411
b85411

Reputation: 10010

Sharing stylesheets between bundles in Symfony2

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?

Upvotes: 2

Views: 274

Answers (1)

DarkLeafyGreen
DarkLeafyGreen

Reputation: 70416

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

Upvotes: 1

Related Questions