0

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

0

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

| improve this answer | |
0

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>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.