From acc611f942d33123aa457c64d88babdfd636870d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=B3=C5=82kowski?= Date: Sun, 7 Jun 2020 07:57:12 +0200 Subject: [PATCH] Create Block: Enhancements for the upcoming npm release (#22978) * Create Block: Revert changes to the list of categories in the prompt Related issue: https://github.com/WordPress/gutenberg/issues/22848 It ensures that blocks will continue to work with WordPress 5.4.x. We should be able to use the new set of categories once WordPress 5.5 is out. * Create Block: Add inline comments explaining how CSS imports in JS work --- packages/create-block/lib/prompts.js | 2 +- .../lib/templates/esnext/src/edit.js.mustache | 5 ++++- .../lib/templates/esnext/src/index.js.mustache | 10 +++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/create-block/lib/prompts.js b/packages/create-block/lib/prompts.js index 5c6d47ea46aa1..5624f984f8292 100644 --- a/packages/create-block/lib/prompts.js +++ b/packages/create-block/lib/prompts.js @@ -70,7 +70,7 @@ const category = { type: 'list', name: 'category', message: 'The category name to help users browse and discover your block:', - choices: [ 'text', 'embed', 'media', 'design', 'widgets' ], + choices: [ 'common', 'embed', 'formatting', 'layout', 'widgets' ], }; const author = { diff --git a/packages/create-block/lib/templates/esnext/src/edit.js.mustache b/packages/create-block/lib/templates/esnext/src/edit.js.mustache index 71eea7e192829..4a34d7ce232de 100644 --- a/packages/create-block/lib/templates/esnext/src/edit.js.mustache +++ b/packages/create-block/lib/templates/esnext/src/edit.js.mustache @@ -6,7 +6,10 @@ import { __ } from '@wordpress/i18n'; /** - * Internal dependencies + * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. + * Those files can contain any CSS code that gets applied to the editor. + * + * @see https://www.npmjs.com/package/@wordpress/scripts#using-css */ import './editor.scss'; diff --git a/packages/create-block/lib/templates/esnext/src/index.js.mustache b/packages/create-block/lib/templates/esnext/src/index.js.mustache index 72fa02b82a751..ef9236403bbf2 100644 --- a/packages/create-block/lib/templates/esnext/src/index.js.mustache +++ b/packages/create-block/lib/templates/esnext/src/index.js.mustache @@ -13,9 +13,17 @@ import { registerBlockType } from '@wordpress/blocks'; import { __ } from '@wordpress/i18n'; /** - * Internal dependencies + * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. + * All files containing `style` keyword are bundled together. The code used + * gets applied both to the front of your site and to the editor. + * + * @see https://www.npmjs.com/package/@wordpress/scripts#using-css */ import './style.scss'; + +/** + * Internal dependencies + */ import Edit from './edit'; import save from './save';