use constantt for block namespace
This commit is contained in:
parent
bcd553f4f0
commit
9b67c4deab
|
@ -1,10 +1,8 @@
|
||||||
**TODO** - currently the block name is hardcoded to `svg` and theme is `room-vw`.
|
|
||||||
Need to use templating to create a `<block-name>.php` file (based on `svg.php)`
|
|
||||||
with the correct theme/block names.
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
Edit `index.php` and `.scss` files, so that the correct block name and
|
||||||
|
namespace are used.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
define( 'BLOCK_NAMESPACE', '<<INSERT BLOCK NAMESPACE HERE>>' )
|
||||||
|
|
||||||
|
$block_namespace = BLOCK_NAMESPACE;
|
||||||
$block_slug = basename( dirname( __FILE__ ) );
|
$block_slug = basename( dirname( __FILE__ ) );
|
||||||
// TODO calculate this correctly whether this file is within a theme or plugin
|
|
||||||
$block_namespace = get_option( 'stylesheet' );
|
|
||||||
|
|
||||||
add_action( 'init', function() {
|
add_action( 'init', function() {
|
||||||
global $block_slug, $block_namespace;
|
global $block_slug, $block_namespace;
|
||||||
|
|
Loading…
Reference in New Issue