Skip to content

Ability to tweak Tailwind with its config file using PostCSS #6

Closed
@nickjj

Description

@nickjj

In this repo's readme there's:

If you need to customize Tailwind, you will need to install it the traditional way using Webpacker instead

I see at the moment there's a hardcoded tailwind.css file in app/assets/stylesheets but in practice it's very common to want to customize Tailwind's fonts, color schemes, etc.. Especially so with Tailwind 2.0 because a lot of the color variants aren't enabled by default and you enable them by customizing the config.

I'm not sure how Tailwind works exactly under the hood but I think Tailwind is just a PostCSS plugin. The creator of Tailwind walks through creating a build step using PostCSS directly in this video https://egghead.io/lessons/tailwind-set-up-tailwind-and-postcss at the 4:04 to 4:49 mark. Basically after you modify your Tailwind config you would run that build step to generate a new tailwind.css file.

Do you foresee an an ability to allow users of this gem to customize Tailwind in the future by having this gem provide a rake task that lets you generate a custom tailwind.css file that uses PostCSS under the hood without the need for Webpacker?

I don't know what the limitations are around using PostCSS within the asset pipeline but if it's usable that would also mean you could use PostCSS plugins such as postcss-import, autoprefixer and also let Tailwind handle purging (it does this by default through PostCSS). I would love to be able to drop Webpacker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions