mirror of
https://github.com/10h30/wp-strava.git
synced 2026-06-05 15:10:01 +09:00
Cleaned up route skeleton
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* The following styles get applied inside the editor only.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
|
||||
.wp-block-wp-strava-route {
|
||||
border: 1px dotted #f00;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Functions to register client-side assets (scripts and stylesheets) for the
|
||||
* Gutenberg block.
|
||||
*
|
||||
* @package wp-strava
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers all block assets so that they can be enqueued through Gutenberg in
|
||||
* the corresponding context.
|
||||
*
|
||||
* @see https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/block-tutorial/applying-styles-with-stylesheets/
|
||||
*/
|
||||
function route_block_init() {
|
||||
// Skip block registration if Gutenberg is not enabled/merged.
|
||||
if ( ! function_exists( 'register_block_type' ) ) {
|
||||
return;
|
||||
}
|
||||
$dir = dirname( __FILE__ );
|
||||
|
||||
$index_js = 'route/index.js';
|
||||
wp_register_script(
|
||||
'route-block-editor',
|
||||
plugins_url( $index_js, __FILE__ ),
|
||||
array(
|
||||
'wp-blocks',
|
||||
'wp-i18n',
|
||||
'wp-element',
|
||||
),
|
||||
filemtime( "$dir/$index_js" )
|
||||
);
|
||||
|
||||
$editor_css = 'route/editor.css';
|
||||
wp_register_style(
|
||||
'route-block-editor',
|
||||
plugins_url( $editor_css, __FILE__ ),
|
||||
array(),
|
||||
filemtime( "$dir/$editor_css" )
|
||||
);
|
||||
|
||||
$style_css = 'route/style.css';
|
||||
wp_register_style(
|
||||
'route-block',
|
||||
plugins_url( $style_css, __FILE__ ),
|
||||
array(),
|
||||
filemtime( "$dir/$style_css" )
|
||||
);
|
||||
|
||||
register_block_type( 'wp-strava/route', array(
|
||||
'editor_script' => 'route-block-editor',
|
||||
'editor_style' => 'route-block-editor',
|
||||
'style' => 'route-block',
|
||||
) );
|
||||
}
|
||||
add_action( 'init', 'route_block_init' );
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* The following styles get applied both on the front of your site and in the editor.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
|
||||
.wp-block-wp-strava-route {
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
padding: 2px;
|
||||
}
|
||||
Reference in New Issue
Block a user