Transform property on all elements
I want to write my JSX with Linaria like this:
so it transforms to something like
How can I achieve that? Is it possible to extend solid babel plugin?
5 Replies
you have to run Linaria before Solid's
Linaria doesn't transform css property itself.
It only ejects css
to .css files and changes expression to class name string
I tried to make custom babel plugin and apply it to solid vite plugin
but settings plugins overrides plugins from vite-plugin-solid itself, so babel-preset-solid disappearsyeah which is my point, you have to make Linaria (or whatever plugin that is) to run before Solid
here's an example: https://github.com/lxsmnsyc/solid-styled/blob/main/packages/vite/src/index.ts
Thank you for giving me confidence. I'm little confused, however, that babel will run three times (my plugin, linaria, then solid)
Maybe I can skip babel parsing and do it through vite/rollup api just with some regular expressions
or just move to rust already
you can also hook it up into solid's plugin, but then the transform must happen before Solid's. The usual trick here is to compile ahead via Program node
RegExp is too limited for JS transforms. You can do SWC if you want