Reputation: 11
I'm new to Symfony and I'm trying to do an app from command
symfony new 'app_name' --version=6.4 --php=8.3 --webapp --docker --cloud
importmap seems to work fine and bootstrap css has been loaded well, the problem is the dropdown menu, I cannot see it.
This is the code in importmap.php:
<?php
//importmap.php
/**
* Returns the importmap for this application.
*
* - "path" is a path inside the asset mapper system. Use the
* "debug:asset-map" command to see the full list of paths.
*
* - "entrypoint" (JavaScript only) set to true for any module that will
* be used as an "entrypoint" (and passed to the importmap() Twig function).
*
* The "importmap:require" command can be used to add new entries to this file.
*/
return [
'app' => [
'path' => './assets/app.js',
'entrypoint' => true,
],
'@hotwired/stimulus' => [
'version' => '3.2.2',
],
'@symfony/stimulus-bundle' => [
'path' => './vendor/symfony/stimulus-bundle/assets/dist/loader.js',
],
'@hotwired/turbo' => [
'version' => '7.3.0',
],
'bootstrap' => [
'version' => '5.3.3',
],
'@popperjs/core' => [
'version' => '2.11.8',
],
'bootstrap/dist/css/bootstrap.min.css' => [
'version' => '5.3.3',
'type' => 'css',
],
'jqueryify' => [
'version' => '1.11.0',
],
];
And this is what's written in app.js:
//app.js
import './bootstrap.js';
import 'bootstrap/dist/css/bootstrap.min.css';
import './styles/app.css';
/*
* Welcome to your app's main JavaScript file!
*
* This file will be included onto the page via the importmap() Twig function,
* which should already be in your base.html.twig.
*/
import '@popperjs/core';
console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');
I have installed bootstrap with command:
bin/console importmap:require bootstrap
and imported into app.js, the fonts are recognized while scripts are not, Symfony doesn't display any error, what is wrong? I really don't have a clue!
01/01/2025 HAPPY NEW YEAR TO EVERYONE!!!! I have bypassed it including bootstrap link and scripts in base.html.twig, this works fine even if it is not the best way to do it, if someone knows how to fix it I will be infinitely grateful to him\her!
Upvotes: 0
Views: 65