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

Create Block: Integrate CSS import in JS with esnext template #22727

Merged
merged 3 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/create-block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- Update `esnext` (default) template to leverage CSS import in JavaScript support added to `@wordpress/scripts` ([#22727](https://github.com/WordPress/gutenberg/pull/22727/files)).

## 0.13.0 (2020-05-28)

### Internal
Expand All @@ -16,7 +20,7 @@

### Enhancements

- Update `esnext` template to scaffold 3 JavaScript source files to illustrate how ES modules help to better organize code.
- Update `esnext` (default) template to scaffold 3 JavaScript source files to illustrate how ES modules help to better organize code ([#21750](https://github.com/WordPress/gutenberg/pull/21750)).

## 0.10.0 (2020-04-01)

Expand Down
4 changes: 2 additions & 2 deletions packages/create-block/lib/templates/esnext/$slug.php.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ function {{namespaceSnakeCase}}_{{slugSnakeCase}}_block_init() {
$script_asset['version']
);

$editor_css = 'editor.css';
$editor_css = 'build/index.css';
wp_register_style(
'{{namespace}}-{{slug}}-block-editor',
plugins_url( $editor_css, __FILE__ ),
array(),
filemtime( "$dir/$editor_css" )
);

$style_css = 'style.css';
$style_css = 'build/style.css';
wp_register_style(
'{{namespace}}-{{slug}}-block',
plugins_url( $style_css, __FILE__ ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import './editor.scss';

gziolo marked this conversation as resolved.
Show resolved Hide resolved
/**
* The edit function describes the structure of your block in the context of the
* editor. This represents what the editor will render when the block is used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
*/

.wp-block-{{namespace}}-{{slug}} {
border: 1px dotted #f00;
border: 1px dotted red;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import './style.scss';
import Edit from './edit';
import save from './save';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

.wp-block-{{namespace}}-{{slug}} {
background-color: #000;
color: #fff;
background-color: theme(button);
gziolo marked this conversation as resolved.
Show resolved Hide resolved
color: white;
padding: 2px;
}