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

Working with multiple entrypoints #46

Open
Gerben321 opened this issue Feb 15, 2024 · 13 comments
Open

Working with multiple entrypoints #46

Gerben321 opened this issue Feb 15, 2024 · 13 comments

Comments

@Gerben321
Copy link

Gerben321 commented Feb 15, 2024

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
Copy link
Author

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

@bocharsky-bw
Copy link
Member

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?

@Gerben321
Copy link
Author

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.

@kevincerro
Copy link

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
Copy link

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

@adeys
Copy link
Contributor

adeys commented Jun 3, 2024

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 ?

@bocharsky-bw
Copy link
Member

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

@adeys
Copy link
Contributor

adeys commented Jun 3, 2024

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

@OcB974
Copy link

OcB974 commented Aug 28, 2024

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.

@bocharsky-bw
Copy link
Member

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

@NodokaMurmevent
Copy link

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.

@adeys
Copy link
Contributor

adeys commented Sep 3, 2024

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!

@NodokaMurmevent
Copy link

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.

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

6 participants