Execute the following commands:
symfony console importmap:require bootstrap
symfony console importmap:require bootstrap/dist/css/bootstrap.min.css
This adds the bootstrap packages to your importmap.php file:
// importmap.php
return [
'app' => [
'path' => './assets/app.js',
'entrypoint' => true,
],
'bootstrap' => [
'version' => '5.3.0',
],
'bootstrap/dist/css/bootstrap.min.css' => [
'version' => '5.3.3',
'type' => 'css',
],
];
Then, import those files:
// assets/app.js
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
References:
https://symfony.com/doc/current/frontend/asset_mapper.html#importing-3rd-party-javascript-packages
https://symfony.com/doc/current/frontend/asset_mapper.html#handling-3rd-party-css