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
Allow blocks usage pattern compatible with codegen #1826
Comments
Quick and dirty script for this: https://gist.github.com/mrclay/f1a949d1be18a44281a1556fe2765971 |
@mrclay thanks for your script. I was facing the same problem and solved it in similar way, but I have never (not even with your script) been able to make faustjs/examples/next/block-support/wp-templates/front-page.js Lines 24 to 35 in 0759959
Were you able to use template string queries/fragments with |
@jan-clockworkwp We updated this https://gist.github.com/mrclay/f1a949d1be18a44281a1556fe2765971 and we had to keep our fragments in separate modules so the script wouldn't import a ton of React code with CSS, etc. |
@mrclay nice one! Thanks for an update. One additional question, to learn something new everyday, if you don't mind. How do you run your |
@jan-clockworkwp Yes, using ts-node. I've just updated it to allow components using innerBlocks. |
@mrclay thanks a lot for confirming that. I really appreciated you script, saved me a lot of time. If I could suggest one small improvement to your script to make it work with |
I'm trying to add TypeScript support to the "blocks-support" example, and finding that the proposed example of specifying fragments from
@faustwp/blocks
is not compatible with codegen.faustjs/examples/next/block-support/wp-templates/front-page.js
Lines 24 to 35 in 0759959
Codegen is able to read fragments from constants defined in the project, but apparently not from an 3rd party package. It doesn't choke, it just silently ignores the query and no
GetPageQuery
type is generated. Arguably this could be a bug with codegen's parser, but I don't think it's a fixable one without having their parser reach into modules and navigate/execute code.I suggest the
@faustwp/blocks
package have a way to generate awp-core-block-fragments.ts
file that uses a codegen-compatible syntax like:In some projects we've just used a single fragment for blocks:
The text was updated successfully, but these errors were encountered: