woocommerce/packages/woocommerce-blocks/assets/js/atomic/utils/render-standalone-blocks.js
2021-12-10 12:03:04 +00:00

28 lines
530 B
JavaScript

/**
* External dependencies
*/
import { renderFrontend } from '@woocommerce/base-utils';
/**
* Internal dependencies
*/
import { getBlockMap } from './get-block-map';
export const renderStandaloneBlocks = () => {
const blockMap = getBlockMap( '' );
Object.keys( blockMap ).forEach( ( blockName ) => {
const selector = '.wp-block-' + blockName.replace( '/', '-' );
const getProps = ( el ) => {
return el.dataset;
};
renderFrontend( {
Block: blockMap[ blockName ],
selector,
getProps,
} );
} );
};