Reputation: 21
I'm building a Symfony web app using version 7.2 and I'm using AssetMapper. I'm trying to use Twitter Bootstrap in my project
The command
symfony console importmap:require bootstrap"
has not downloaded the bootstrap.js library.
So I run
symfony console importmap:require bootstrap/dist/js/bootstrap.min.js
and now I have the correct file in asset\vendor
directory.
Now my importmap.php
contains
return [
...
'bootstrap/dist/js/bootstrap.min.js' => [
'version' => '5.3.3',
],
...
]
How can I import that file so that the JS can be used in my templates ?
Thanks in advance
Upvotes: 1
Views: 45
Reputation: 21
I think I have identified the error.
First I need to import the CSS part
symfony console importmap:req bootstrap/dist/css/bootstrap.min.css
And insert the import in asset/app.js
import 'bootstrap/dist/css/bootstrap.min.css';
Then I need to import the correct JS part, which is ..bundle.. and not ..min..
symfony console importmap:req bootstrap/dist/js/bootstrap.bundle.min.js
And insert the correct import in asset/app.js
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
Now it seems everything is working correctly.
Upvotes: 1