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?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityMagento 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.