Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using flowbite with assets-mapper #61

Open
LyamD opened this issue Jul 10, 2024 · 1 comment
Open

Using flowbite with assets-mapper #61

LyamD opened this issue Jul 10, 2024 · 1 comment

Comments

@LyamD
Copy link

LyamD commented Jul 10, 2024

Hi, I'm trying to use the flowbite plugin with Symfony 7, assets-mapper and the tailwind-bundle.

I can't get the JS of flowbite to work. I've followed line by line the Symfony documentation, restarted the project from scratch, also tried the few tricks from this issue: #36

No matter how I import ("flowbite/plugin", "flowbite/plugin.js", full path), and I think i've tried every combination possible within app.js, tailwind.config.js and importmap.php, but it is still not working.

I don't have any js console errors, custom js and css are loaded, but none of the flowbite component are working.

What am I missing ? Is it still possible to do it ?

@bocharsky-bw
Copy link
Member

Hm, the import path should be relative, it depends on where the file is located in which you're trying to include that flowbite. But IIRC you need to import the main flowbite package:

// The path should be correct only if you're in assets/app.js, otherwise change it correspondively
import '../vendor/flowbite/flowbite.js';

And I think in your tailwind.config.js it should be something like:

module.exports = {
  content: [
    './templates/**/*.html.twig',
    './assets/**/*.js',
    './assets/vendor/flowbite/**/*.js',
  ],
  theme: {
    extend: {},
  },
  plugins: [
    require('./assets/vendor/flowbite/plugin'),
  ],
};

And in importmap.php:

return [
    'imports' => [
        'flowbite' => 'assets/vendor/flowbite/flowbite.js',
    ],
];

I hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants