In magento 1, I have used addCss function to add css file to head.
However, I don't see this function in magento 2. Can you help me?
-
Are you trying to add the the head of all pages?themanwhoknowstheman– themanwhoknowstheman2016年01月02日 21:28:36 +00:00Commented Jan 2, 2016 at 21:28
1 Answer 1
Magento 2 has a quite different approach to CSS, where the Less pre-processor is an important part the play.
In layouts there you can add have a <css> element in <head>, so you do it via configuration rather than PHP code.
But there is also the whole Less infrastructure where maybe you want to use the _extend.less file to merge your CSS into the main CSS file generated rather than forcing the web browser to download an additional page. So I would suggest you also read up on Less support in Magento.