Dwlad90 / stylex-swc-plugin

Community NAPI-RS/SWC plugin for StyleX.
MIT License
40 stars 3 forks source link

Documentaton: explain how to use as an swc plugin only #62

Open GiancarlosIO opened 4 days ago

GiancarlosIO commented 4 days ago

Hi there!!!

The project looks amazing!! Thanks for you effort creating this!

I was wondering how can we integrate this with our custom tools or bundlers, for example with rspack or rsbuild.

For example, in rsbuild you can configure swc plugins:

image

Would be really good to document/explain how to use it as a swc plugin outside of nextjs.

I assume that the plugin lives in stylex-rs-compiler, maybe just need to document how to use it and what options we have there?

Again, thanks for the package!

Best.

Dwlad90 commented 4 days ago

Hi @GiancarlosIO,

Thank you for your interest in this project.

I opened a PR #63 with the updated documentation of the SWC plugin. I hope it is now a little clearer how to work with it. If there are any other suggestions or corrections, I am open to dialogue.

In the future, there are plans to write plugins for various bundlers and compilers. If you can help with this, I will be grateful.

P.S., If you need to extract CSS during build, then I recommend paying attention to @stylexswc/rs-compiler. It requires a little more configuration to work with, but it provides a more convenient way to interact with metadata, as it was specified in the RFC #39. Inside the compiler, the same SWC plugin code is used.