update swithcbuf
This commit is contained in:
parent
b12e317651
commit
e43e75b20e
|
@ -16,38 +16,18 @@ public function $1($2) {
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet wprb "function register_block() { ..."
|
snippet psf "public static function ..."
|
||||||
function ${1/-/_/g}_${2/-/_/g}_register_block() {
|
public static function $1($2) {
|
||||||
|
$0
|
||||||
// automatically load dependencies and version
|
|
||||||
$asset_file = include( plugin_dir_path( __FILE__ ) . '$2/build/index.asset.php');
|
|
||||||
|
|
||||||
wp_register_script(
|
|
||||||
'${1:plugin-name}-${2:block-name}',
|
|
||||||
plugins_url( '$2/build/index.js', __FILE__ ),
|
|
||||||
$asset_file['dependencies'],
|
|
||||||
$asset_file['version']
|
|
||||||
);
|
|
||||||
|
|
||||||
wp_register_style(
|
|
||||||
'$1-$2-style',
|
|
||||||
plugins_url( '$2/build/style.css', __FILE__ ),
|
|
||||||
array(),
|
|
||||||
filemtime ( plugin_dir_path( __FILE__ ) . '$2/build/style.css' )
|
|
||||||
);
|
|
||||||
|
|
||||||
wp_register_style(
|
|
||||||
'$1-$2-editor',
|
|
||||||
plugins_url( '$2/build/editor.css', __FILE__ ),
|
|
||||||
array(),
|
|
||||||
filemtime ( plugin_dir_path( __FILE__ ) . '$2/build/editor.css' )
|
|
||||||
);
|
|
||||||
|
|
||||||
register_block_type( 'myguten/$1-$2', array(
|
|
||||||
'style' => '$1-$2-style',
|
|
||||||
'editor_style' => '$1-$2-editor',
|
|
||||||
'editor_script' => '$1-$2',
|
|
||||||
) );
|
|
||||||
}
|
}
|
||||||
add_action( 'init', '${1/-/_/g}_${2/-/_/g}_register_block' );
|
endsnippet
|
||||||
|
|
||||||
|
snippet prsf "public static function ..."
|
||||||
|
private static function $1($2) {
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ''= "'...' => "
|
||||||
|
'$1' => $0,
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
Loading…
Reference in New Issue