问题
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.
回答1:
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') }}">
回答2:
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.
来源:https://stackoverflow.com/questions/43494418/how-to-add-css-files-on-a-sylius-theme