(no title)
chungwu | 2 years ago
You can check out how it works (https://docs.plasmic.app/learn/codegen-guide/), but also happy to answer questions here!
chungwu | 2 years ago
You can check out how it works (https://docs.plasmic.app/learn/codegen-guide/), but also happy to answer questions here!
superfrank|2 years ago
My question is more focused on the idea that at some point there will be something that I need to do that can't be done through the WYSIWYG editor. I'm wondering what happens in that use case. Can I open up VS code and start changing the underlying code myself? If so how does the tool maintain those changes through iterations and how maintainable is the code that Plasmic generates?
My concern comes from the fact that I've used some of these tools in the past and the code they spit out will have things like 8 levels of nested divs for no reason, empty tags, and inlined and !important styles all over the place. I'm not saying Plasmic will do that, but I'm wondering if anyone who has used this can say how good or bad the generated code actually is.
chungwu|2 years ago
As for the actually generated code, it basically maps to what you've created yourself in the studio. Plasmic does have a styling / element abstraction, but it's fairly low-level, and everything is pretty close to how you'd write a React component yourself. If you're not creating empty divs in the editor, you shouldn't see empty divs in the generated code :-)
chungwu|2 years ago
This is Plasmic-generated code that we ourselves use to build our visual editor.
nkozyra|2 years ago
I think that actually amplifies the concern. Basically it's "don't touch the output," but what if we want/need to?
chungwu|2 years ago
jason_plasmic|2 years ago
In case you still want to see the code from codegen, here's an example. We generate 3 files per page/component:
1. JS/TS: https://github.com/plasmicapp/plasmic/blob/master/platform/w...
2. CSS: https://github.com/plasmicapp/plasmic/blob/master/platform/w...
3. An entry point wrapper JS/TS file: https://github.com/plasmicapp/plasmic/blob/master/platform/w...
While 1 and 2 will be overwritten as you update your project in Plasmic (and therefore you should never modify it), the wrapper (3) is yours to customize as needed, like setting props or binding event handlers. In the above example, we computed how much free trial time a customer has. You can read more about the generated code here: https://docs.plasmic.app/learn/codegen-components/