Exemple avec l'import de Bootstrap
php bin/console importmap:require bootstrap
Cela mettra à jour votre fichier importmap.php
// importmap.php
return [
'app' => [
'path' => './assets/app.js',
'entrypoint' => true,
],
'bootstrap' => [
'version' => '5.3.8',
],
];
Pour récupérer les Css de Bootstrap :
php bin/console importmap:require bootstrap/dist/css/bootstrap.min.css
Cela mettra à jour votre fichier importmap.php
// importmap.php
return [
'app' => [
'path' => './assets/app.js',
'entrypoint' => true,
],
'bootstrap' => [
'version' => '5.3.0',
],
'bootstrap/dist/css/bootstrap.min.css' => [
'version' => '5.3.8',
'type' => 'css',
],
];
Il ne reste plus qu'à mettre à jour votre fichier app.js :
// assets/app.js
import './bootstrap.js';
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
// console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');