tailwind-bundle icon indicating copy to clipboard operation
tailwind-bundle copied to clipboard

Working with multiple entrypoints

Open Gerben321 opened this issue 1 year ago • 13 comments

Hey,

I wanted to try out assetmapper and had to use this bundle. I couldn't understand why my error entrypoint (used for testing) didn't get any styling. I tried my main entrypoint (app.js and app.css) and that works fine.

So how do I get my other entrypoints working? I tried this config: symfonycasts_tailwind: input_css: 'assets/styles/error.css' But that breaks my normal entrypoint. I want to keep my stuff separated, thanks.

Gerben321 avatar Feb 15 '24 09:02 Gerben321

Any solution? Sadly asset mapper is no working solution for me now.

Gerben321 avatar Feb 22 '24 12:02 Gerben321

Hey @Gerben321 ,

Unfortunately, input_css is a scalar node so you can set it only to a single path, it does not support array of input css files. I suppose you're looking for something like:

symfonycasts_tailwind:
    input_css:
        - 'assets/styles/other.css'
        - 'assets/styles/error.css'

Do you want to give it a try to implement this feature?

bocharsky-bw avatar Feb 23 '24 11:02 bocharsky-bw

That's exactly what I'm looking for yes. For now I've moved further away from Asset mapper with many Symfony UX features that are very experimental with Asset mapper, or don't work. So I'm not sure if I will try it again. But I could give it a shot if I got some time left with a blank project.

Gerben321 avatar Feb 23 '24 11:02 Gerben321

I'm having the same issue

I have 2 entrypoints, app and status

Tailwind works when using app entrypoint, but not when using status

kevincerro avatar Apr 15 '24 18:04 kevincerro

I'm having the same issue

I have 2 entrypoints, app and status

Tailwind works when using app entrypoint, but not when using status

Finally we migrated to webpack encore bundle while this is improved. We need multiple entrypoints

kevincerro avatar Apr 16 '24 09:04 kevincerro

Hey @Gerben321 ,

Unfortunately, input_css is a scalar node so you can set it only to a single path, it does not support array of input css files. I suppose you're looking for something like:

symfonycasts_tailwind:
    input_css:
        - 'assets/styles/other.css'
        - 'assets/styles/error.css'

Do you want to give it a try to implement this feature?

Hello @bocharsky-bw. Can we still propose an implementation for this ?

adeys avatar Jun 03 '24 02:06 adeys

Hey! If users need this feature - I'm not against adding it, PRs are always welcome. Do you want to try to implement it?

bocharsky-bw avatar Jun 03 '24 09:06 bocharsky-bw

Great. Yes I'll submit a PR for this.

adeys avatar Jun 03 '24 09:06 adeys

Hello :)

I had a problem when I used several css files in my assets/styles (app.css & admin.css for example), and it compiled the app.css file each time. I use symfony's AssetMapper

While testing, I created the yaml file symfonycasts_tailwind.yaml with this configuration in the config/package folder

symfonycasts_tailwind:
    input_css:
        - '%kernel.project_dir%/assets/styles/app.css'
        - '%kernel.project_dir%/assets/styles/admin.css'

Except that in the config/package folder it didn't work, and when I installed the bundle I didn't have the file.

To get around this while waiting for a fix, I had to put it in my services.yaml file. And now it works, with symfony's AssetMapper.

With the command :

symfony console tailwind:build
symfony console tailwind:build assets/styles/admin.css 

First command compiles the file into app.built.css (the default) and Second command it compiles the admin.build.css file for me.

KarlZero974 avatar Aug 28 '24 18:08 KarlZero974

This bundle has good defaults and you don't need to change the config often. That's why no symfonycasts_tailwind.yaml file is created, this bundle just does not have a Flex recipe. If you need to tweak the default config - you have to create the config file manually and put the config you want, see the docs for available configuration

bocharsky-bw avatar Aug 28 '24 20:08 bocharsky-bw

Hello i try to configure like this (i use AssetMapper) :

symfonycasts_tailwind:
  input_css:
    - '%kernel.project_dir%/assets/styles/app.css'
    - '%kernel.project_dir%/assets/styles/wheel.css'
    - '%kernel.project_dir%/assets/styles/quiz.css'

but it’s doing nothing, all the files are ignored when i use php bin/console tailwind:build --watch

i have the last version of your bundle. Something seam to be broken.

NodokaMurmevent avatar Sep 03 '24 12:09 NodokaMurmevent

Hello @NodokaMurmevent

Currently, when using the --watch flag, you need to explicitly specify each input CSS file you want to watch, as the Tailwind binary does not support watching multiple files simultaneously. If no input file is provided, only the first file is considered.

In your case, you’ll need to run three separate commands—one for each CSS file you want to watch. I'll look into improving this experience in the future if possible. Thanks for your understanding!

adeys avatar Sep 03 '24 13:09 adeys

Ok! Thanks for your explanation, I will just merge all my CSS files into one app.css, it’s not a big deal, I can wait. It’s not forbid me to split my JS file.

Thanks for your bundle and all your work, I use it every day.

NodokaMurmevent avatar Sep 03 '24 13:09 NodokaMurmevent