Skip to content
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

Update examples to use wp-scripts 5.0.0 #89

Merged
merged 4 commits into from Sep 19, 2019
Merged

Update examples to use wp-scripts 5.0.0 #89

merged 4 commits into from Sep 19, 2019

Conversation

mkaz
Copy link
Member

@mkaz mkaz commented Sep 19, 2019

Let's do all the updates...

  • Update examples package to use wp-scripts version 5.0.0
  • Update examples to use index.assets.php file to auto load the dependencies and version
  • Switch syntax to use import { ... } from '@wordpress/package'

Additionally, I removed the check for register_block_type function, since it is available in WP 5.0+. I don't think it is still necessary to show an example for it.

Fixes #88
Fixes #90
Also probably makes PR #87 obsolete.

@mkaz mkaz changed the title Add auto loading of depepencies Update examples to use wp-scripts 5.0.0 Sep 19, 2019
@mkaz
Copy link
Member Author

mkaz commented Sep 19, 2019

Since this was a large set of changes I additional bumped the plugin versions to 1.1.0
I'm not really sure if it makes much difference.

@mkaz mkaz requested a review from gziolo September 19, 2019 20:38
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one. I like how this slowly gets easier to maintain. Next step is proposing to WP core a way to read the asset file to make the script registration a one liner 😃

01-basic-esnext/src/index.js Outdated Show resolved Hide resolved
@mkaz mkaz merged commit 616dfc9 into master Sep 19, 2019
@mkaz mkaz deleted the update/deps-json branch September 19, 2019 20:54
@gziolo
Copy link
Member

gziolo commented Sep 20, 2019

🎉

Also probably makes PR #87 obsolete.

Yes, I will close that one 👍

mkaz added a commit to WordPress/gutenberg that referenced this pull request Sep 20, 2019
Updates the examples to use the syntax:

    import { ... } from '@wordpress/package';

instead of

    const { ... } = wp.package;

This is more consistent and better for webpack and build setup.

The gutenberg-examples repo was already switched to use import syntax
in: WordPress/gutenberg-examples#89
@gziolo
Copy link
Member

gziolo commented Sep 21, 2019

I missed one thing when doing review. Those import statements should have the corresponding entries in package.json file in “dependencies” section.

mkaz added a commit to WordPress/gutenberg that referenced this pull request Sep 25, 2019
* Convert examples to use import syntax

Updates the examples to use the syntax:

    import { ... } from '@wordpress/package';

instead of

    const { ... } = wp.package;

This is more consistent and better for webpack and build setup.

The gutenberg-examples repo was already switched to use import syntax
in: WordPress/gutenberg-examples#89

* Update docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md

Co-Authored-By: Chris Van Patten <chris@vanpattenmedia.com>

* Update docs/designers-developers/developers/tutorials/block-tutorial/creating-dynamic-blocks.md

Co-Authored-By: Chris Van Patten <chris@vanpattenmedia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update import to use standard syntax build php dependencies etc. are not used
2 participants