Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add css to only homepage from xml in magento

Tags:

css

xml

magento

Want to include css file which is applicable to only homepage from xml file.
Tried this :

<cms_index_index>
 <action add css>
   .
   .
 </action> 
</cms_index_index>

using this in local.xml adds that particular css in every cms page.
Any Idea ?
Thanks in Advance.

like image 772
Nikhil_K_R Avatar asked Nov 16 '12 06:11

Nikhil_K_R


People also ask

How do I enable and generate CSS critical path in Magento 2?

Enable CSS critical pathCSS critical path configuration is located on the Stores > Settings > Configuration > ADVANCED > Developer tab. However, the Developer tab is hidden in production mode. Once in production mode, CSS critical path can only be enabled using the CLI. Make sure that there is a critical.


1 Answers

In the cms home page there is Design(Layout Update XML) use the following code in that

<reference name="head">
 <action method="addItem"><type>skin_js</type><name>js/myjavascript.js</name></action>
</reference>
like image 150
Leo Avatar answered Sep 25 '22 00:09

Leo