Magento – adding bootstrap to magento 2

magento2rwd

Adding the direct bootstrap online link conflicts with the layout. I've compiled bootstrap for just the responsive grid, but cannot find exactly where to place this bootstrap.min.css and how to link it from my homepage. All i want is the responsive grid. I'm running a child theme off Luma.

Magento version 2.0.13

Best Answer

You can include it in CMS home page as follows.

app/design/frontend/Vendor/theme/Magento_Cms/layout/cms_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/framework/Module/etc/module.xsd">
  <head>
    <css src="css/bootstrap.min.css" />
  </head>
</page>

Put bootstrap.min.css in app/design/frontend/Vendor/theme/web/css/

At last deploy static content as follows.

php bin/magento setup:static-content:deploy
Related Topic