From e2c4bb83d4e50f8511728c5ec7f07a7f81fbbfc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= <mail@fabian-kaegy.de> Date: Tue, 10 May 2022 09:23:35 +0200 Subject: [PATCH] update block example to use new asset syntax --- .../includes/blocks/example-block/block.json | 41 ++++++++++--------- .../includes/blocks/example-block/editor.css | 0 .../includes/blocks/example-block/index.js | 3 -- .../includes/blocks/example-block/script.js | 5 +++ .../example-block/{index.css => style.css} | 0 .../includes/blocks/example-block/view.js | 5 +++ projects/10up-theme/package.json | 1 - 7 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 projects/10up-theme/includes/blocks/example-block/editor.css create mode 100644 projects/10up-theme/includes/blocks/example-block/script.js rename projects/10up-theme/includes/blocks/example-block/{index.css => style.css} (100%) create mode 100644 projects/10up-theme/includes/blocks/example-block/view.js diff --git a/projects/10up-theme/includes/blocks/example-block/block.json b/projects/10up-theme/includes/blocks/example-block/block.json index 17e1ba37..b8f7b457 100644 --- a/projects/10up-theme/includes/blocks/example-block/block.json +++ b/projects/10up-theme/includes/blocks/example-block/block.json @@ -1,35 +1,35 @@ { "title": "Example Block", "description": "An Example Block", - "text-domain": "tenup-scaffold", + "textdomain": "tenup-scaffold", "name": "tenup/example", - "icon": "feedback", - "category": "tenup-scaffold-blocks", - "attributes":{ + "icon": "feedback", + "category": "tenup-scaffold-blocks", + "attributes": { "customTitle": { - "type" : "string" + "type": "string" } - }, - "example": { - "attributes":{ - "customTitle": "Example Block" - } - }, - "supports": { + }, + "example": { + "attributes": { + "customTitle": "Example Block" + } + }, + "supports": { "align": false, "alignWide": false, "anchor": false, - "color":{ + "color": { "gradients": false, "background": false, "text": false }, "customClassName": false, "defaultStylePicker": false, - "typography": { - "fontSize": false, - "lineHeight": true - }, + "typography": { + "fontSize": false, + "lineHeight": true + }, "html": false, "inserter": true, "multiple": true, @@ -38,6 +38,9 @@ "padding": false } }, - "editorScript": "file:../../../dist/blocks/example-block/editor.js", - "editorStyle": "file:../../../dist/blocks/example-block/editor.css" + "editorScript": "file:./index.js", + "editorStyle": "file:./editor.css", + "style": "file:./style.css", + "viewScript": "file:./view.js", + "script": "file:./script.js" } diff --git a/projects/10up-theme/includes/blocks/example-block/editor.css b/projects/10up-theme/includes/blocks/example-block/editor.css new file mode 100644 index 00000000..e69de29b diff --git a/projects/10up-theme/includes/blocks/example-block/index.js b/projects/10up-theme/includes/blocks/example-block/index.js index 59cd4967..889ce908 100644 --- a/projects/10up-theme/includes/blocks/example-block/index.js +++ b/projects/10up-theme/includes/blocks/example-block/index.js @@ -16,9 +16,6 @@ import edit from './edit'; import save from './save'; import block from './block.json'; -/* Uncomment for CSS overrides in the admin */ -import './index.css'; - /** * Register block */ diff --git a/projects/10up-theme/includes/blocks/example-block/script.js b/projects/10up-theme/includes/blocks/example-block/script.js new file mode 100644 index 00000000..5fec7744 --- /dev/null +++ b/projects/10up-theme/includes/blocks/example-block/script.js @@ -0,0 +1,5 @@ +import domReady from '@wordpress/dom-ready'; + +domReady(() => { + console.log('DOM ready!'); +}); diff --git a/projects/10up-theme/includes/blocks/example-block/index.css b/projects/10up-theme/includes/blocks/example-block/style.css similarity index 100% rename from projects/10up-theme/includes/blocks/example-block/index.css rename to projects/10up-theme/includes/blocks/example-block/style.css diff --git a/projects/10up-theme/includes/blocks/example-block/view.js b/projects/10up-theme/includes/blocks/example-block/view.js new file mode 100644 index 00000000..5fec7744 --- /dev/null +++ b/projects/10up-theme/includes/blocks/example-block/view.js @@ -0,0 +1,5 @@ +import domReady from '@wordpress/dom-ready'; + +domReady(() => { + console.log('DOM ready!'); +}); diff --git a/projects/10up-theme/package.json b/projects/10up-theme/package.json index 82aee07b..83efdac5 100644 --- a/projects/10up-theme/package.json +++ b/projects/10up-theme/package.json @@ -35,7 +35,6 @@ "shared-style": "./assets/css/shared/shared-style.css", "styleguide-style": "./assets/css/styleguide/styleguide.css", "core-block-overrides": "./includes/core-block-overrides.js", - "example-block": "./includes/blocks/example-block/index.js", "test-style": "./assets/css/frontend/testing.scss" } }