I have to add bootstrap 3 or 4 to my custom theme (magento 2.2.5) I tried this: How to use bootstrap in my custom theme and this Bootstrap in magento 2 theme but these ways don't work with magento 2.2.5
<head>
<css src="css/bootstrap.css" />
<css src="css/bootstrap.css.map" />
<css src="css/bootstrap.min.css" />
<css src="css/bootstrap.min.css.map" />
<css src="css/bootstrap-grid.css" />
<css src="css/bootstrap-grid.css.map" />
<css src="css/bootstrap-grid.min.css" />
<css src="css/bootstrap-grid.min.css.map" />
<css src="css/bootstrap-reboot.css" />
<css src="css/bootstrap-reboot.css.map" />
<css src="css/bootstrap-reboot.min.css" />
<css src="css/bootstrap-reboot.min.css.map" /></head>
default_head_blocks.xml (head section)
var config = {
paths: {
'bootstrap':'Magento_Theme/js/bootstrap.bundle',
} ,
shim: {
'bootstrap': {
'deps': ['jquery']
}
}
};
Magento_Theme/requirejs-config.js
<script type="text/javascript">
require(['bootstrap']);
</script>
Magento_Theme/templates/html/header.phtml Also I added Bootstrap css flies at (vendor/my_theme/web/css) and added Bootstrap js files at (vendor/my_theme/Magento_Theme/web/js) I use bootstrap 4 and magento 2.2.5