JavaScript for WordPress Forums Gutenberg Development Enqueueing block assets

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45377
    jasonyingling
    Participant

    I was going through the handbook and noticed in the Writing Your First Block Type section it shows the main block script being enqueued in the register_block_type function using editor_script.

    Is this another method for enqueuing block assets or is it outdated? I actually wasn’t able to find a mention of enqueue_block_editor_assets and enqueue_block_assets in the Gutenberg Handbook.

    #45409
    Zac Gordon
    Keymaster

    I believe these docs are outdated.

    The approach of registering the block on the server side is still being evolved, so I think it’s better and more flexible (and following existing WP conventions) to use enqueue_block_editor_assets and enqueue_block_assets but both approaches should still work I believe.

    #45417
    jasonyingling
    Participant

    Thanks for the response. That was my thought too from browsing the repo.

    In my search I did come across this ticket about bundling assets for the font-end which has some cool ideas being thrown around. https://github.com/WordPress/gutenberg/issues/5445

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.