✨ improve: js boilerplate
This commit is contained in:
@@ -1,21 +1,13 @@
|
||||
import { domReady } from '@roots/sage/client';
|
||||
|
||||
/**
|
||||
* app.main
|
||||
* Application entrypoint
|
||||
*/
|
||||
const main = async (err) => {
|
||||
if (err) {
|
||||
// handle hmr errors
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
// application code
|
||||
};
|
||||
domReady(async () => {
|
||||
// ...
|
||||
});
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*
|
||||
* @see https://webpack.js.org/api/hot-module-replacement
|
||||
* @see {@link https://webpack.js.org/api/hot-module-replacement/}
|
||||
*/
|
||||
domReady(main);
|
||||
import.meta.webpackHot?.accept(main);
|
||||
import.meta.webpackHot?.accept(console.error);
|
||||
|
||||
@@ -2,26 +2,18 @@ import {domReady} from '@roots/sage/client';
|
||||
import { registerBlockStyle, unregisterBlockStyle } from '@wordpress/blocks';
|
||||
|
||||
/**
|
||||
* editor.main
|
||||
* Editor entrypoint
|
||||
*/
|
||||
const main = (err) => {
|
||||
if (err) {
|
||||
// handle hmr errors
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
domReady(() => {
|
||||
unregisterBlockStyle('core/button', 'outline');
|
||||
|
||||
registerBlockStyle('core/button', {
|
||||
name: 'outline',
|
||||
label: 'Outline',
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*
|
||||
* @see https://webpack.js.org/api/hot-module-replacement
|
||||
* @see {@link https://webpack.js.org/api/hot-module-replacement/}
|
||||
*/
|
||||
domReady(main);
|
||||
import.meta.webpackHot?.accept(main);
|
||||
import.meta.webpackHot?.accept(console.error);
|
||||
|
||||
Reference in New Issue
Block a user