Tag: node.js

  • wp-now

    wp-now

    wp-now streamlines the process of setting up a local WordPress environment.”

    https://www.npmjs.com/package/@wp-now/wp-now

    If you want to host and run a WordPress Playgroundyou can install it via Node.js. First install node.js – if you don’t have it yet, follow the guide on the node.js webpage.

    Node.js works on Linux, Mac and Windows.

    Then install the package wp-now by npm, like this_

    
    sudo npm install -g @wp-now/wp-now
    cd my-plugin-or-theme-directory
    npx @wp-now/wp-now start
    • First line: on Linux and Mac use sudo, but probably not on windows.
    • Second line: you change to the directory with the theme or plugin to be tested.
    • Third line: now this will install WordPress in a hidden directort, and open a browser after a few seconds.

    Then you’re ready to develop or test.

    Reset

    When you restart the site will appear as when you left it. However, sometimes you may need a new version. You can reset your site like this, and then you’ll get a new WP for your experiments:

    npx @wp-now/wp-now start --reset

    Start in a Theme Directory

    A fast way to test a theme is to start wp-now up in the theme directory or in a plugin directory. Wp-now will then open WordPress in that theme. This is supereasy:

    cd /localhost/wordpress/wp-content/themes/your-theme/
    npx @wp-now/wp-now start
    wp-now started my homemade theme from the theme directory. In this way wp-now is a great tool when you need to test either a theme or a plugin.

    Blueprint

    A blueprint is a JSON file, that will define settings like the version of PHP or WordPress. You can install plugins and themes via blueprints too. You can load the blueprint like this:

    npx @wp-now/wp-now start --blueprint=path/to/blueprint.json

    The content of blueprint.json could be something along these lines:

    {
        "landingPage": "/wp-admin/",
        "preferredVersions": {
            "php": "7.4",
            "wp": "5.9"
        },
        "phpExtensionBundles": [
            "kitchen-sink"
        ],
        "steps": [
            {
                "step": "login",
                "username": "admin",
                "password": "password"
            },
            {
                "step": "installPlugin",
                "pluginZipFile": {
                    "resource": "wordpress.org\/plugins",
                    "slug": "instant-images"
                },
                "options": {
                    "activate": true
                }
            },
            {
                "step": "installPlugin",
                "pluginZipFile": {
                    "resource": "wordpress.org\/plugins",
                    "slug": "w3-total-cache"
                },
                "options": {
                    "activate": true
                }
            },
            {
                "step": "installPlugin",
                "pluginZipFile": {
                    "resource": "wordpress.org\/plugins",
                    "slug": "wordpress-seo"
                },
                "options": {
                    "activate": false
                }
            },
            {
                "step": "installPlugin",
                "pluginZipFile": {
                    "resource": "wordpress.org\/plugins",
                    "slug": "ewww-image-optimizer"
                },
                "options": {
                    "activate": true
                }
            },
            {
                "step": "installPlugin",
                "pluginZipFile": {
                    "resource": "wordpress.org\/plugins",
                    "slug": "blocks-animation"
                },
                "options": {
                    "activate": true
                }
            },
            {
                "step": "installPlugin",
                "pluginZipFile": {
                    "resource": "wordpress.org\/plugins",
                    "slug": "font-awesome"
                },
                "options": {
                    "activate": true
                }
            }       
        ]
    }

    “Man” wp-now start — help

    Here are the options from the man page:

    Options:
    –version Show version number [boolean]
    –path Path to the PHP or WordPress project. Defaults to the current working directory. [string]
    –php PHP version to use. [string]
    –wp WordPress version to use: e.g. ‘–wp=6.2’ [string]
    –port Server port [number]
    –blueprint Path to a blueprint file to be executed [string]
    –reset Create a new project environment, destroying the old project environment. [boolean]
    –skip-browser Do not launch the default browser
    [boolean] [default: false]
    –inspect Use Node debugging client. [number]
    –inspect-brk Use Node debugging client. Break immediately on script execution start. [number]
    –trace-exit Prints a stack trace whenever an environment is exited proactively, i.e. invoking process.exit(). [number]
    –trace-uncaught Print stack traces for uncaught exceptions; usually, the stack trace associated with the creation of an Error is
    printed, whereas this makes Node.js also print the stack trace associated with throwing the value (which does not need to be an Error instance). [number]
    –trace-warnings Print stack traces for process warnings (including deprecations). [number]
    -h, –help Show help [boolean]

    For more information, see:

Enable Notifications OK No thanks

We use cookies - more information

Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.

Close