editor.js (678B)
1 /** 2 * This is the file that Webpack is compiling into editor_blocks.js 3 */ 4 5 /** 6 * Internal dependencies 7 */ 8 import './fontawesome' 9 10 /** 11 * External dependencies 12 */ 13 import registerBlock from '~redux-templates/register-compnant' 14 15 // Import all index.js and register all (if name & settings are exported by the script) 16 const importAllAndRegister = r => { 17 r.keys().forEach( key => { 18 const { name, settings } = r( key ) 19 try { 20 return name && settings && registerBlock( name, settings ) 21 } catch ( error ) { 22 console.error( `Could not register ${ name } block` ) // eslint-disable-line 23 } 24 } ) 25 } 26 27 importAllAndRegister( require.context( './block', true, /index\.js$/ ) )