Magento 2.1.x vs 2.2.x : Difference in including css,js,google fonts

Magento 2.1.x and 2.2.x have different ways of including scripts

Scripts and css can be included in default_head_blocks.xml file of layout in theme or any custom module.

Magento 2.1.x


<css src="css/default.css" />       <!-- CSS -->
<link src="js/theme-script.js"/>    <!-- JS -->
<!-- Google Fonts -->
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu:400,500,700,400italic,700italic|Muli:400,400italic" src_type="url"  />
Magento 2.2.x


<css src="css/default.css" />       <!-- CSS -->
<script src="js/theme-script.js"/>  <!-- JS -->
<!-- Google Fonts -->
<link rel="stylesheet" src="//fonts.googleapis.com/css?family=Ubuntu:400,500,700,400italic,700italic|Muli:400,400italic" src_type="url"  />
For external google fonts "src" is used instead of "href".
For JS "script" tag is used instead of "link" 

No comments:

Post a Comment

Buy/Sell Source Code of Website,Apps,Softwares

Install sample data in magento 2