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

Add support for custom tailwind css installs #152

Open
oliverandrich opened this issue Feb 16, 2025 · 3 comments
Open

Add support for custom tailwind css installs #152

oliverandrich opened this issue Feb 16, 2025 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@oliverandrich
Copy link
Member

Given the existence of node-wheel-binaries on PyPI and the broken PyCharm plugin for Tailwind CSS, which relies on a locally installed Tailwind CSS, it might be an idea to another mode for the library.

The library currently supports three modes:

  1. By default it uses the official CLI builds.
  2. A locally installed binary can be used by setting TAILWIND_CLI_PATH to the complete path.
  3. Install an externally built binary by specifying TAILWIND_CLI_SRC_REPO and TAILWIND_CLI_ASSET_NAME.

With the introduction of Tailwind CSS 4.x support, the library relies on checking the major version of Tailwind CSS. This is necessary because of the change behaviour concerning configuration but also because the --config parameter isn't available in Tailwind CSS CLI 4.x.

This breaks as mentioned in #150 (comment) the behavior for externally build versions of Tailwind CSS, that don't follow the official versioning scheme. This applies for example to https://github.com/dobicinaitis/tailwind-cli-extra if you try to install it using the settings TAILWIND_CLI_SRC_REPO and TAILWIND_CLI_ASSET_NAME.

Based on the things stated above, I am considering changing the behavior of the library and supporting the following modes:

  1. By default, it uses the official CLI builds and can support Tailwind CSS 3.x and 4.x.
  2. A globally installed binary can be used by setting TAILWIND_CLI_PATH to the absolute path.
  3. Install an externally built binary by specifying TAILWIND_CLI_SRC_REPO and TAILWIND_CLI_ASSET_NAME.
  4. A project local installed binary is used. This installation is based on node-wheel-binaries and fully encapsulated by the library. It would only introduce a package.json file to the project.

For mode 2, 3 and 4, a new variable TAILWIND_CLI_LEGACYis introduced. If it is set to True, the library assumes the interface of Tailwind CSS CLI 3.x and otherwise the interface of Tailwind CSS CLI 4.x. The default would be False.

The advantage of mode 4 is, that it adds support for PyCharm without any awful hacks, without the necessity to handle a node installation yourself. And it might also be the easiest way to add support for DaisyUI and friends.

Discuss! Feedback welcome.

@oliverandrich oliverandrich added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Feb 16, 2025
@oliverandrich
Copy link
Member Author

It might even be an idea to completely switch to a solution based on node-wheel-binaries? The only disadvantage is, that it needs more disk space compared to the prebuilt CLI. 90 MB for a shared binary vs. 160 MB per project.

Or just combine option 3 and 4 by dropping option 3, but extending option 4 by the possibility to install additional node packages like daisyUI.

@applewebbo
Copy link

+1 for latest solution with the possibility to install also plugin like daisyui. My current setup involves installing daisyui using bun. If I can get rid of that part it will be great

@adamghill
Copy link

Option 4 (or combining 3+4) makes sense to me. The extra disk space is a trade-off I'm personally ok with. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants