dylanirlbeck / tailwind-ppx

A Reason/OCaml Pre-Processor eXtension (PPX) that validates your Tailwind classes at compile-time.
MIT License
152 stars 15 forks source link

Call for features! #34

Closed dylanirlbeck closed 4 years ago

dylanirlbeck commented 4 years ago

I'd love to hear everyone's feedback on new features you'd like to see in the PPX. Please thread ideas below so we can discuss!

zth commented 4 years ago

One feature I personally think would be cool is to instead of asking for the compiled Tailwind CSS file, asking the user to point to the CSS file where they include the Tailwind code (like @import "tailwindcss/base"; etc). You could then use the Tailwind CLI via npx or similar to compile that into the CSS you need, parse and cache that in a more suitable format yourself in the PPX (maybe in a similar way to how graphql_ppx caches the processed schema). This would mean a few things:

Dunno if it's feasible, but it's an idea at least 😃

sync commented 4 years ago

yes same would make it easier to work with next.js, if you look at the default example you don't even have access the the main tailwind css: https://github.com/zeit/next.js/tree/canary/examples/with-tailwindcss

(it get generated and minified inside the .next folder on build, in dev mode it's inside a tmp folder somewhere)

azkane commented 4 years ago

It would be cool to support conditionally added classes, I'm currently doing it like this, but don't think it should be the right approach.

test

I'll help with patches if we can agree on some syntax for it

dylanirlbeck commented 4 years ago

@azkane Check out this comment where I answered a question directly related to your issue. I like the API of [%tw "..."] because it simplifies the extractor function logic (for PurgeCSS), but I'm open to suggestions if you have any.

dylanirlbeck commented 4 years ago

@sync I think your suggestion is totally valid -- for any production app you'll likely be using PostCSS and not manually generating the Tailwind file. I think it's clear that this is the direction in which tailwind-ppx needs to go, so I'll make this the next big feature.

dylanirlbeck commented 4 years ago

I'm going to close this out and instead instruct people to open an issue if they have feature requests. Thank you all for your comments!