Closed dylanirlbeck closed 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:
graphql_ppx
does for refreshing the compiled output - produce a hash for the contents, look them up each time and recompile if needed. This would mean you can rely on always having an up to date representation of what you need, rather than relying on the user to manually recompile Tailwind when stuff changes.Dunno if it's feasible, but it's an idea at least 😃
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)
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.
I'll help with patches if we can agree on some syntax for it
@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.
@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.
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!
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!