4

I've a custom theme under app/theme/AcmeTheme. I have the theme working and I can define my own templates under views or override template for other Bundles. The problem is that I can not figure out how to add a custom CSS file inside my theme. So fat I've tried:

AcmeTheme/public/style.css AcmeTheme/web/style.css

But after running assets:install and sylius:theme:assets:install the file is not copied. I have read the documentation multiple times and I can still not get it to work.

Pablo
  • 133
  • 1
  • 10

2 Answers2

3

Place your style.css in app/themes/AcmeTheme/SyliusShopBundle/public/ and run sylius:theme:assets:install. Now your style.css should be available in web/bundles/_themes/AcmeTheme/template/syliusshop/ and you can include it in the html.twig with <link rel="stylesheet" href="{{ asset('bundles/syliusshop/styles.css') }}">

chaenu
  • 1,915
  • 16
  • 32
  • Thanks, that works. Is it possible to add it directly from a folder on the theme `app/themes/AcmeTheme/public`? Or do themes always have to override the `SyliusShopBundle`? – Pablo Apr 24 '17 at 15:42
  • According to http://docs.sylius.org/en/latest/book/themes/themes.html (note on the bottom) you could include them directly in app/themes/AcmeTheme/web/assets as well – chaenu Apr 24 '17 at 21:34
  • Well, according to https://github.com/Sylius/Sylius/issues/8161 it's no longer possible to include them directly in app/themes/AcmeTheme/web/assets - so the solution in the answer is the right way to go. – chaenu Aug 01 '17 at 07:36
1

Solution with assets in app/themes/AcmeTheme/web/assets/ doesn't work for me. Only way to add custom assets is via app/themes/AcmeTheme/SyliusShopBundle/public/ which is pretty odd.

czende
  • 837
  • 5
  • 10
  • I've marked the previous answer as the solution because it's something that works, but I still don't know how to do what you are looking for either. Documentation is not clear about it. – Pablo Jun 01 '17 at 16:12