Skip to content

Instantly share code, notes, and snippets.

@vanaf1979
Last active August 2, 2020 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanaf1979/33e3202d0c7dc7b1fad140d647292524 to your computer and use it in GitHub Desktop.
Save vanaf1979/33e3202d0c7dc7b1fad140d647292524 to your computer and use it in GitHub Desktop.
Gist for my article: WordPress: Adding custom svg icons to your Gutenberg blocks/plugin. https://since1979.dev/wordpress-adding-custom-svg-icons-to-your-gutenberg-blocks-plugin/
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
import icons from './icons/icons.js'
registerBlockType("va79/blockname", {
title: __("Blockname"),
icon: icons.github, // The Block icon
category: "layout",
keywords: [__("Blockname")],
attributes: {
...
},
edit: ( { attributes, className, isSelected, setAttributes } ) => {
...
},
save: props => {
...
},
});
@devNigel
Copy link

devNigel commented Aug 2, 2020

it is giving the error "Uncaught SyntaxError: Cannot use import statement outside a module". Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment