Skip to content

Add support for custom tailwind css installs #152

Closed
@oliverandrich

Description

@oliverandrich

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions