I have to create one page like offers (It will show all offers here).
I have to include bootstrap in this offers page only.
Thanks SomuN
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 communityI have to create one page like offers (It will show all offers here).
I have to include bootstrap in this offers page only.
Thanks SomuN
You will have specific layout handle for this offers page e.g offers_index_index.xml
You need to add bootstrap in the head section of this file as follows:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Vendor_Module::css/bootstratp.css" rel="stylesheet" type="text/css" />
<script src="Vendor_Module::js/bootstrap.js"/>
</head>
Where as you can place js and css files in Vendor/Module/view/frontend/web/js and Vendor/Module/view/frontend/web/css
for adding JS use requirejs-config.js file
var config = {
map: {
'*': {
bootstrap: 'Vendor_Module::js/bootstrap.js'
}
}
};
then use on particular page
define([
"jquery",
"bootstrap"
],
function($, bootstrap) {
"use strict";
// write here anything that u want
return;
});
Now for Css
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Vendor_Module::css/bootstratp.css"/>
</head>
</page>