Hi I'm trying to include an external css/js
in Magento. From what I found one suggestion is to put this under
<module>/view/frontend/layout/default.xml
which is what I did and was able to achieve this. But the issue with this approach is that it's application wide meaning all website, store and other view will have this CSS and JS.
But what I would want is that it should only be applied on a per website level. So let say I have :
**website id = 1** which include **123.css** and **123.js**
**website id = 2** will include **234.css** and **234.js**
But I have no idea on how to achieve this. I'm willing to change my current approach as long as this is achieve. Right now the application is reading from default.xml
which all website will include also.
Is there a way to make it so that website 1 will include default1.xml and website 2 will include default2.xml or something? and Magento will include this xml file depending on the website requesting this.
Any suggestion would be much appreaciated. Below is the content of my default.xml
<?xml version="1.0"?>
<page xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<head>
<!-- Add js using link tag-->
<link src="js/external_js_include.js"/>
<css src="css/external_css_include.css" />
</head>
</page>