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

postcss.config.js support #304

Open
nedpals opened this issue Apr 4, 2019 · 5 comments
Open

postcss.config.js support #304

nedpals opened this issue Apr 4, 2019 · 5 comments

Comments

@nedpals
Copy link

nedpals commented Apr 4, 2019

First of all, what a wonderful tool you built there as Gatsby is really overkill with the project I'm working right now. Just curious, does Charge support using custom PostCSS config through postcss.config.js? I am trying to import Tailwind and other useful stuff into my project and can't seem to find it at the docs at all. :/

@brandonweiss
Copy link
Owner

Thanks! That’s great to hear! ☺️

That question has been bouncing around in the back of my mind ever since I started working on Charge. I know most tools like Babel, PostCSS, browserlist, etc. allow a sort of cascading configuration, where you can pass options in programmatically, or define them in package.json, or in a configuration file at the root of your project.

Charge is “zero-config” in that I haven’t designed any way to configure Charge or the tools that it uses. However, in theory, if the tool allows defining a configuration file, I assume that would probably work? You should try it out and let me know!

You also mentioned trying to use Tailwind… are you just trying to import a CSS file? The docs on stylesheets explain how to import a CSS file. If you’re trying to do something more complicated let me know and I’ll explain if it’s possible and/or how to do it (and update the docs).

@offsounder
Copy link

I believe you can still make use all of tailwind's extra features without adding it into the postcss build process, although you would need to process your css with tailwind as an extra step before using charge.

@brandonweiss, would you consider adding support for css modules using postcss? It would be a nice alternative to using emotion for scoped styling.

@brandonweiss
Copy link
Owner

@tonesetter Thanks for asking! I considered supporting CSS modules when I was first building Charge, but ultimately I decided not to add them—here’s my reasoning.

Charge’s philosophy is fundamentally about having less choice (e.g. no configuration). I try to only have one way of doing a thing if possible, and to only support really standard and common abilities that everyone would want (e.g. autoprefixer).

Some people might want CSS modules, but more people probably just want to link to a stylesheet. And for a small site (which is Charge’s niche) you’re probably not going to really run into the cascade issues that CSS modules solves. And if you do, then I think the styled components pattern would be a user-land way to solve that problem that is low effort and doesn’t require adding anything to Charge. So in this case, I just don’t think the benefit of having more choice would outweigh the cost of having more choice 😕 Sorry about that!

@offsounder
Copy link

Thanks @brandonweiss, that's understandable. Even without css modules, I think charge is a really great and simple way to start using components for static sites.

@brandonweiss
Copy link
Owner

@tonesetter Thanks! I’m glad you like it! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants