Skip to content

Commit

Permalink
Add PascalCase slug to create-block template strings (#35462)
Browse files Browse the repository at this point in the history
* Add PascalCase slug to create-block template strings

* Update changelog

* Update packages/create-block/CHANGELOG.md

Co-authored-by: Marcus Kazmierczak <[email protected]>
  • Loading branch information
opr and mkaz authored Oct 8, 2021
1 parent 8d8e076 commit e839a9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/create-block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

### New Features
- Add `slugPascalCase` to the list of variables that can be used in templates ([#35462](https://github.com/WordPress/gutenberg/pull/35462))

## 2.5.0 (2021-07-21)

### Enhancements
Expand Down
3 changes: 2 additions & 1 deletion packages/create-block/lib/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
const { writeFile } = require( 'fs' ).promises;
const { snakeCase } = require( 'lodash' );
const { snakeCase, camelCase, upperFirst } = require( 'lodash' );
const makeDir = require( 'make-dir' );
const { render } = require( 'mustache' );
const { dirname, join } = require( 'path' );
Expand Down Expand Up @@ -53,6 +53,7 @@ module.exports = async (
namespaceSnakeCase: snakeCase( namespace ),
slug,
slugSnakeCase: snakeCase( slug ),
slugPascalCase: upperFirst( camelCase( slug ) ),
title,
description,
dashicon,
Expand Down

0 comments on commit e839a9d

Please sign in to comment.