diff --git a/helpers.js b/helpers.js index 7771c69..ec2a05d 100644 --- a/helpers.js +++ b/helpers.js @@ -115,7 +115,7 @@ export function capitalize(str) { return str .toLowerCase() - .split(/[ -_]/g) + .split(/[-_ ]/g) .filter((word) => !!word) .map((word) => { return word.charAt(0).toUpperCase() + word.slice(1); diff --git a/package-lock.json b/package-lock.json index 780050e..4161986 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@axe-web/block-dev-tool", - "version": "1.0.30", + "version": "1.0.31", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@axe-web/block-dev-tool", - "version": "1.0.30", + "version": "1.0.31", "license": "ISC", "dependencies": { "@axe-web/create-block": "^1.1.30", diff --git a/package.json b/package.json index a026729..a689fce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@axe-web/block-dev-tool", - "version": "1.0.30", + "version": "1.0.31", "author": { "name": "AXE-WEB", "email": "office@axe-web.com", diff --git a/platforms/php/build.php b/platforms/php/build.php index cd4fd62..bdf92cf 100644 --- a/platforms/php/build.php +++ b/platforms/php/build.php @@ -71,8 +71,8 @@ class Component_Builder { $this->register_default_handlebar_helpers(); $this->add_handlebar( 'base_url', function ( $context ) { - $path = join( '/', [ 'blocks', $this->block_project, $this->block_name, 'templates' ] ); - return plugins_url( $path . '/', 'axeweb-blocks-library/axeweb-blocks-library.php' ); + $path = join( '/', [ $this->block_project, $this->block_name, 'templates' ] ); + return join( '/', [ get_site_url(),'wp-content', 'axe-web-blocks', $path, '' ] ); } ); } diff --git a/platforms/wordpress/templates/Template_Component.php b/platforms/wordpress/templates/Template_Component.php index c7b0aa5..675593d 100644 --- a/platforms/wordpress/templates/Template_Component.php +++ b/platforms/wordpress/templates/Template_Component.php @@ -22,8 +22,8 @@ class <%= blockClassModel %>_Component extends \Core\Component { // $version = \Core\Global_Functions::get_current_version_number(); // In Theme // $base_path = get_template_directory_uri() . '/components/partials/<%= blockFilename %>/'; - wp_enqueue_style( 'block-<%= blockFilename %>', plugins_url( 'templates/styles/<%= blockFilename %>.min.css', __FILE__ ), ['assets-style'], self::VERSION );<% if (include_script) { %> - wp_enqueue_script( 'block-<%= blockFilename %>', plugins_url( 'templates/scripts/<%= blockFilename %>.min.js', __FILE__ ), ['assets-script'], self::VERSION, true );<% } %> + wp_enqueue_style( 'block-<%= blockFilename %>', $this->get_assets_path_url( 'templates/styles/<%= blockFilename %>.min.css' ), ['assets-style'], self::VERSION );<% if (include_script) { %> + wp_enqueue_script( 'block-<%= blockFilename %>', $this->get_assets_path_url( 'templates/scripts/<%= blockFilename %>.min.js' ), ['assets-script'], self::VERSION, true );<% } %> wp_enqueue_script( 'script-block-<%= blockFilename %>' ); }<% } %> @@ -32,13 +32,13 @@ class <%= blockClassModel %>_Component extends \Core\Component { 'style_assets' => [ [ 'name' => '<%= blockFilename %>', - 'url' => plugins_url( 'templates/styles/<%= blockFilename %>.min.css', __FILE__ ), + 'url' => $this->get_assets_path_url( 'templates/styles/<%= blockFilename %>.min.css' ), ] ], 'script_assets' => [ [ 'name' => '<%= blockFilename %>', - 'url' => plugins_url( 'templates/scripts/<%= blockFilename %>.min.js', __FILE__ ), + 'url' => $this->get_assets_path_url( 'templates/scripts/<%= blockFilename %>.min.js' ), ] ] ] ); @@ -50,7 +50,7 @@ class <%= blockClassModel %>_Component extends \Core\Component { $asset_file_front = include( plugin_dir_path( __FILE__ ) . '/templates/gutenberg-block/build/front.asset.php' ); wp_enqueue_script( 'gutenberg-<%= blockFilename %>-scripts-front', - plugins_url( 'templates/gutenberg-block/build/front.js', __FILE__ ), + $this->get_assets_path_url( 'templates/gutenberg-block/build/front.js' ), $asset_file_front['dependencies'], $asset_file_front['version'], true