PHP code example of aslamhus / wordpress-hmr

1. Go to this page and download the library: Download aslamhus/wordpress-hmr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aslamhus / wordpress-hmr example snippets


   /** Database hostname */
   define( 'DB_HOST', '127.0.0.1:8889' );
   

   define( 'WP_ENVIRONMENT_TYPE', 'development' )
   
json
{
  "assets": {
    "enqueue_block_editor_assets": [
      {
        "handle": "editor-js",
        "path": "/js/editor",
        "ext": "js"
      }
    ]
  }
}
json
{
  "assets": {
    "wp_enqueue_scripts": [
      {
        "path": "/js/screen",
        "ext": "js",
        "condition": ["get_the_title", ["function", "get_the_id"], "about"]
      }
    ]
  }
}
bash
   # cd into your project root
   cd /path/to/your/project-root
   # move the installer
   mv vendor/aslamhus/wordpress-hmr/installer.php ./installer.php
   # run the installer
   php installer.php
   
json
{
  "assets": {
    "enqueue_block_editor_assets": [
      {
        "handle": "editor-js",
        "path": "/js/editor",
        "ext": "js"
      }
    ],
    "wp_enqueue_scripts": [
      {
        "path": "/js/screen",
        "ext": "js",
        "condition": ["is_user_logged_in", null, false]
      }
    ]
  }
}