Closed nasatome closed 4 years ago
Hello, I'm new to the world of Wordpress, and I'm a beginner so I don't know the best practices.
I'm currently developing a theme, and I'm adding some gutenberg plugins to it, I use the following commands:
npm install @wordpress/scripts --save-dev npm start
this generates me a index.js file inside a build folder that I added by means of
index.js
build
wp_register_script('custom-blocks', get_template_directory_uri().'/build/index.js',array('wp-blocks','wp-editor','wp-data'),microtime(),true);
is there any way to generate and import this file without continually compiling that file? (or should I add it to the gulp process?) or could it be imported directly my jsx type files? by placing it in the assess/js/index.js folder ?
assess/js/index.js
//index.js import './blocks/quote';
//blocks/quote.js const {registerBlockType} = wp.blocks; const {InnerBlocks, RichText} = wp.editor; registerBlockType("ak/quote", { title: "Custom Block", description: "this is a description", icon: "smiley", category: "layout", //custom attributes attributes: { title: { type: "string", source: "html", selector: "h2" }, body: { type: "string", source: "html", selector: "p" } }, edit ({attributes, setAttributes}) { ...
Sorry we don't provide support here.
Hello, I'm new to the world of Wordpress, and I'm a beginner so I don't know the best practices.
I'm currently developing a theme, and I'm adding some gutenberg plugins to it, I use the following commands:
this generates me a
index.js
file inside abuild
folder that I added by means ofis there any way to generate and import this file without continually compiling that file? (or should I add it to the gulp process?) or could it be imported directly my jsx type files? by placing it in the
assess/js/index.js
folder ?