Closed toby-griffiths closed 10 months ago
And of course, immediately after I typed that I had another idea… and worked it out.
For anyone finding this and wondering the same thing, simply npm init
in the same directory as the tailwind.config.js
file, npm install flowbite
, and then the TailwindCSS build should find it just dandy.
Do you know if this is likely to be updated to support the 'node/npm-less' approach we can now use with the release of the AssetMapper component?
Hi @toby-griffiths :wave:
I asked myself exactly the same question about this subject and came across this issue . I've found a solution (similar to yours):
$ symfony console importmap:require flowbite/plugin
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./vendor/tales-from-a-dev/flowbite-bundle/templates/**/*.html.twig",
"./assets/**/*.js",
"./templates/**/*.html.twig",
],
theme: {
extend: {},
},
plugins: [
require('./assets/vendor/flowbite/plugin.js'), // <===
],
}
Now, the tailwind build should work ;)
Edit: Finally, it seems break further on deps from the plugin itself (I don't know why it worked for a time, maybe not a fresh build or something else) :/
Thanks for the additional info @Inkod. Sounds like a better fix might be required somehow.
I tried multiples hack to find a way without to have to install package via npm but without success.. It helped me understand the whole system a little better.
In the case of a tailwind plugin that has no dependencies on other packages (except the tailwind packages themselves), there will be no problem using a path to the packages installed via AssetMapper. However, if the plugin has an another deps like flowbite
with mini-svg-data-uri
, tailwind build will try to found it in node_modules, but inevitably, there aren't any.
Anyway, I think Tailwind is build to work with node to resolve child deps from plugins package, and so, it needs to have a package.json for each packages..
As a result, I don't know if there's much point in using the "AssetMapper" component if you want to be able to make full use of tailwind and the related plugins. WebpackEncore might seem more appropriate for the moment to avoid having to maintain both a list of packages via importmap and via npm.
Hey!
Tailwind is a pure Node package, so if it has any deps, those should be installed with npm. We now have a section that talks about this - https://symfony.com/bundles/TailwindBundle/current/index.html#tailwind-plugins - we also cover Flowbite specifically at the end of our latest tutorial - https://symfonycasts.com/screencast/last-stack/flowbite
Cheers!
If I use symfony assert mapper, its not working. I tried the following both not working, after installing,
First, I installed by following Symfony and Tailwind CSS starter project
symfony console import:require flowbite
and symfony console import:require flowbite/plugin
plugins: [
require('@tailwindcss/typography'),
require('./assets/vendor/flowbite/plugin')
],
and
plugins: [
require('@tailwindcss/typography'),
require('flowbite/plugin')
],
@featuriz That Symfony/Tailwind CSS starter project uses Webpack Encore (https://github.com/themesberg/tailwind-symfony-starter/blob/main/composer.json#L42) and not AssetMapper Component.
This could be the culprit of your issue.
I tried using the "tailwindcss-debug-screens" plugin and it worked for me! Just installed it via asset mapper like so:
php bin/console importmap:require tailwindcss-debug-screens
After installing I added the following line to the tailwind.config.js:
plugins: [
require('./assets/vendor/tailwindcss-debug-screens/tailwindcss-debug-screens.index'),
]
I wanted to give the AssetMapper a try in a brand new project, but I can't get it to work with flowbite/plugin, tried everything mentioned here including a couple more things.
Hello there 👋🏼
Thank you for all the work you've put into this plugin.
I have a question about using 3rd party plugins…. I've been wracking my brain to try to work out how to install the Flowbite plugin using Symfony's
importmap:require
command… and then I realised that the way I learned to include thetailwindcss/plugin
as found in this Symfonycast works even when the project does not have anytailwindcss
files in the./assert/vendor
directory, so I have 2 questions…1 . How does this code work? i.e. where is the plugin file actually found? Is it inside the Tailwind binary, perhaps?…
tailswindcss:build
process?Here's how I've tried it…
tailwindcss.config.js
file…$ symfony console tailwindcss:build
Error: Cannot find module 'flowbite/plugin' Require stack: