SymfonyCasts / tailwind-bundle

Delightful Tailwind Support for Symfony + AssetMapper
https://symfony.com/bundles/TailwindBundle/current/index.html
MIT License
75 stars 16 forks source link

Manage multiple outputs depending on the input #63

Open maximehuran opened 3 weeks ago

maximehuran commented 3 weeks ago

I am using the multiple CSS entries and it is very nice. I am compiling multiples themes and their input file are always app.css but in different folders.

I think it could be great to use the folder of the input in the output file :

https://github.com/SymfonyCasts/tailwind-bundle/blob/main/src/TailwindBuilder.php#L113

Maybe with a hash or using the %kernel.project_dir%/folder/to/the/file/app.css to folder-to-the-file-app.css

Or give the outpile file in the configuration for each entry

bocharsky-bw commented 3 weeks ago

Could you elaborate on it a bit more? What is your initial reason for having multiple output files? Do you want to include those different output files in different spots? Something else?

IMO it might be too minor because with proper caching you still may use the same file, and in some cases, it might be even better because of the cache instead of including multiple files.

Also, if having different output files for different input files may confuse some users who want to use different input files and compile everything in the 1 output file for simplicity.

Or give the outpile file in the configuration for each entry

Specifying an output file name for each input file may be too verbose and would complicate the configuration. IMO, the best solution would be to have a boolean config option, something like multiple_output_css: true that will be false by default. Though it still may be confusing.

But I'm not sure how many people would need it, probably if it's an edge case - better to override some internal files in your project and implement something like this in your specific app.

maximehuran commented 1 week ago

I am in a Sylius app with many themes. For now I managed my case with that change :

image

It's dirty but I will be able to improve that if the bundle is more flexible on that.