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

Add PascalCase slug to create-block template strings #35462

Merged
merged 3 commits into from
Oct 8, 2021

Conversation

opr
Copy link
Contributor

@opr opr commented Oct 8, 2021

Description

This PR will make a new token available to the templated files used with @wordpress/create-block. It will allow templates to replace {{slugPascalCase}} with the extension's slug but in PascalCase.

This could be useful in cases where templates generate classes, These should be written in PascalCase, and currently there's no way to do this.

How has this been tested?

I have created an example template package, (https://www.npmjs.com/package/blocks-template) the repo for this package is here: https://github.com/opr/blocks-template/ and the slugPascalCase is used in the $slug.php.mustache file.

From the root of this repo:

  1. Run npx wp-create-block -t blocks-template my-test-extension.
  2. Navigate to my-test-extension and view my-test-extension.php
  3. See the class name generated is MyTestExtension_Blocks_Integration

Types of changes

New feature to the create-block package.

Checklist:

  • My code is [manually] tested.
  • My code follows the WordPress code style.

@opr opr requested review from gziolo and mkaz as code owners October 8, 2021 11:59
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Oct 8, 2021
@github-actions
Copy link

github-actions bot commented Oct 8, 2021

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @opr! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@opr
Copy link
Contributor Author

opr commented Oct 8, 2021

I'm not sure if I'll need to update the changelog and package versions in this PR, or if this will be done as a next step when releasing the package. If it's required now then please let me know and I'll add it :)

@gziolo gziolo added [Package] Create Block /packages/create-block [Type] New API New API to be used by plugin developers or package users. labels Oct 8, 2021
@gziolo gziolo added this to Needs review in Core JS Oct 8, 2021
Copy link
Member

@mkaz mkaz left a comment

Choose a reason for hiding this comment

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

This looks good, thank you for the contribution.

Yes, you do need to update the CHANGELOG under the ## Unreleased section. Since it looks like there is not anything added yet. Add a subsection ### New Features and your update.

You do not need to update version numbers, that is handled by the release process.

@opr opr requested a review from mkaz October 8, 2021 13:53
Copy link
Member

@mkaz mkaz left a comment

Choose a reason for hiding this comment

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

Thanks for the update, I made a minor change to use the precise name for the variable.

@opr
Copy link
Contributor Author

opr commented Oct 8, 2021

Thanks for the update, I made a minor change to use the precise name for the variable.

Thanks for the review and thanks for updating that, I appreciate it.

@mkaz mkaz merged commit e839a9d into WordPress:trunk Oct 8, 2021
@github-actions
Copy link

github-actions bot commented Oct 8, 2021

Congratulations on your first merged pull request, @opr! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 11.8 milestone Oct 8, 2021
@gziolo gziolo moved this from Needs review to Done in Core JS Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Create Block /packages/create-block [Type] New API New API to be used by plugin developers or package users.
Projects
No open projects
Core JS
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants