Git Product home page Git Product logo

Comments (6)

Log1x avatar Log1x commented on August 26, 2024 2

Do wp acorn vendor:publish without specifying the provider and choose from the list (working on a fix in Acorn)

from poet.

haynzz avatar haynzz commented on August 26, 2024 2

I have to be honest, if it wasn't for this issue thread I would not have been able to get it running.
But, now it worked for me.
I assume it's because I'm new to everything. I have no experience in WP Theme development and I have started with sage10. So, I have also never created my own Gutenberg block before.
The major issues that needed trial and error and closer reading for me were:

  1. I have to register via the new block via editor.js - got to know the registerBlockType this way
  2. the namespaces have to match everywhere (sage/<myblock> by default) so that the resources/views/blocks/<myblock>.balde.php file is loaded – learned that it works as I expect it when I do not provide a save property during block registration
    • Disclaimer not tried to get InnerBlocks working yet

One question that is still open for me: Can I set the block-category for a block in the poet.php or does it need to be via registerBlockType in the JS files?

-- EDIT --
I forgot to thank you @Log1x for this package. It was still fun to figure the things out from above.
-- EDIT --

-- EDIT 2--
I think I have finally understood why the confusion.
This package is to get a server side configured more easily mostly for existing blocks – amongst all the other things like taxonomy etc.
It does not to be in the scope of the package to create custom blocks.
I think the confusion started since I landed on this repo from a link in another discussion that was about custom block creation.
Now, I understand how to use this package.
-- EDIT 2--

from poet.

Log1x avatar Log1x commented on August 26, 2024 1

did you register the block in javascript?

e.g.

import { __ } from '@wordpress/i18n'
import { registerBlockType } from '@wordpress/blocks'
import { InnerBlocks } from '@wordpress/block-editor'

/** components */
import edit from './edit.js'

registerBlockType(`block/accordion`, {
  title: __(`Accordion`, `sage`),
  category: `formatting`,
  icon: `format-image`,
  attributes: {
    accordions: {
      type: 'array',
      default: [{ label: 'New accordion' }],
    },
  },
  edit,
  save: () => <InnerBlocks.Content />,
})

from poet.

StudioRATATA avatar StudioRATATA commented on August 26, 2024 1

did you register the block in javascript?

Ah no, I did not. I naively assumed the plugin handled the block registration, much like the acf approach in Log1x/acf-composer since I read nothing about it in the readme. I've worked with wp-blocks boilerplates before. They watch and build the .js files and the build files are being served.

If I place your snippit simply in a /App/blocks/accordion/block.js file (along with a editor.js file) and enqeue them I get an Es6 import error. So I guess I miss extra steps and knowledge :)

How would I handle this?


The wp acorn vendor:publish did the trick, thanks. I've had this with several composer plugins. I can now use this elsewhere as well. Thanks Brandon.

from poet.

StudioRATATA avatar StudioRATATA commented on August 26, 2024 1

Literately seconds later I figured I could place this in the assets folder... Like /resources/assets/scripts/blocks/accordion/block.js And import them in the editor.js. No luck yet, but now, it builds : )

-- edit --
Even though I typed editor here, I actually placed it in the app.js. Now it all shows up in the wp - editor . Party-party!

May I suggest to make a note of this in the readme? The part of needing to add the registerBlockType() to the assets folder and a reference to the documentation.
Or better yet, a code example from, like you just shared.
-- end edit --

from poet.

aitormendez avatar aitormendez commented on August 26, 2024

I have "Unable to locate publishable resources" too.

from poet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.