woocommerce/packages/woocommerce-blocks/assets/js/atomic/utils/render-standalone-blocks.js

28 lines
530 B
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
/**
* 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,
} );
} );
};