Is there a way to register a custom block within a theme and like a plugin?

  • Unknown's avatar

    Hi! I am excited about a new approach to registering custom blocks within block.json. Please, tell me, can I use block.json only when registering a block like a plugin?

    If I need to create some quantity of custom blocks each of which will have several variations, how I should do this in the best way? (Blocks will be on JSX and I don’t want to create a plugin for each block)

    1. Create one plugin for all blocks (I don’t want a folder with npm dependencies in each block folder).
    2. Create a block theme including custom blocks (not like plugins).

    I noticed when I register the block through npx @wordpress/create-block in my custom theme folder – all works (but still I don’t want node_modules folders for each plugin). Could there be issues in the future if I register blocks this way in a theme or better do it through the plugins folder?

  • Hi there,

    I do not see any sites under your @raspberrywww
    WordPress.com account when I check on our end. You can confirm by visiting this page: https://wordpress.com/sites.

    Is it possible you created your site under a different login instead? What is the URL of the site you need help with?

    Happy to check in our system so we can take a closer look.

  • The topic ‘Is there a way to register a custom block within a theme and like a plugin?’ is closed to new replies.