Is there any way to use ifconfig
in Magento 2 to conditionally add CSS assets, similar to Magento 1? Here's an example from Magento 1:
<action ifconfig="config_path/group/field" method="addItem">
<type>skin_css</type><name>css/styles.css</name>
</action>
I tried something like this in Magento 2 but it doesn't work:
<head>
<css src="css/styles.css"
ifconfig="config_path/group/field" />
</head>
It just displays the ifconfig
attribute on frontend:
<link rel="stylesheet" type="text/css"
ifconfig="config_path/group/field"
href="http://example.com/pub/static/frontend/Magento/luma/en_US/css/styles.css" />
Is there any equivalent in Magento 2?