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

Tailwind stylesheets are not generated for stylesheets other than app.css #78

Open
kniziol opened this issue Jan 5, 2025 · 3 comments

Comments

@kniziol
Copy link

kniziol commented Jan 5, 2025

The problem

If you define more than one input_css path in the config/packages/symfonycasts_tailwind.yaml configuration file, Tailwind stylesheets are not generated for that CSS inputs:

# config/packages/symfonycasts_tailwind.yaml

symfonycasts_tailwind:
    input_css:
        - assets/app/styles/app.css
        - assets/orange-pizza/styles/orange-pizza.css
        - assets/brave-elephant/styles/brave-elephant.css

Please see an example in the following repository:
https://github.com/kniziol/TailwindBundle-and-AssetMapper

Steps to reproduce the issue

  1. Clone https://github.com/kniziol/TailwindBundle-and-AssetMapper repo

  2. Install DDEV. See more: Get Started

  3. Run the following commands to start the project:

    ddev composer install
    ddev launch
  4. Go to https://symfony-asset-mapper-paths-separation.ddev.site/brave/elephant

  5. See the error:

    An exception has been thrown during the rendering of a template ("Built Tailwind CSS file does not exist: run "php bin/console tailwind:build" to generate it").
    
  6. Run the command:

    ddev console tailwind:build

    See output similar to this one:

     ! [NOTE] Downloading TailwindCSS binary from https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.17/tailwindcss-linux-arm64
    
     40525732/40525732 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
     ! [NOTE] Executing Tailwind (pass -v to see more details).                                                             
    
    
    Rebuilding...
    
    Done in 90ms.
  7. Refresh the page: https://symfony-asset-mapper-paths-separation.ddev.site/brave/elephant

  8. Unfortunately, the error still exists 👇

TailwindBundle - Built Tailwind CSS file does not exist

More information

Stylesheet for the app entrypoint has been generated only:

ls -alh var/tailwind/
total 24
drwx------@ 4 kn  staff   128B Jan  5 19:00 .
drwx------@ 5 kn  staff   160B Jan  5 18:59 ..
-rw-------@ 1 kn  staff    10K Jan  5 19:00 app.built.css // <------- Here
drwx------@ 3 kn  staff    96B Jan  5 19:00 v3.4.17

I expected stylesheets generated for all CSS inputs defined in the configuration file:

# config/packages/symfonycasts_tailwind.yaml

symfonycasts_tailwind:
    input_css:
        - assets/app/styles/app.css
        - assets/orange-pizza/styles/orange-pizza.css
        - assets/brave-elephant/styles/brave-elephant.css
@kniziol
Copy link
Author

kniziol commented Jan 5, 2025

It looks like this is connected to #46

@kniziol
Copy link
Author

kniziol commented Jan 5, 2025

Workaround

Run the bin/console tailwind:build multiple times for each CSS stylesheet 👇

# For the assets/app/styles/app.css
ddev console tailwind:build
# For the assets/orange-pizza/styles/orange-pizza.css
ddev console tailwind:build assets/orange-pizza/styles/orange-pizza.css
# For the assets/brave-elephant/styles/brave-elephant.css
ddev console tailwind:build assets/brave-elephant/styles/brave-elephant.css

The same applies when we want to "watch" changes:

ddev console tailwind:build --watch
ddev console tailwind:build assets/orange-pizza/styles/orange-pizza.css --watch
ddev console tailwind:build assets/brave-elephant/styles/brave-elephant.css --watch

@bocharsky-bw
Copy link
Member

This behaviour is because of the reason explained here: #46 (comment)

So this is a problem upstream. If you have any ideas how to fix it - please, feel free to create a PR

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