1.0.5 • Published 2 years ago

buildwp v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

About The Project

A simple, easy to use build tool for WordPress plugins/themes. Handles CSS/JS/PHP, builds to project directory or local dev server, and packages cleanly into a zip file for release and install via wp-admin.

Built With

Getting Started

To get up and running follow these simple steps.

Prerequisites

Installation

  1. install package
    npm i -D buildwp
  2. run setup
    npx buildwp setup

Usage

After running "npx buildwp setup", a very basic folder structure and some default config files will be copied into your project root. Only files/folders added under the "src" directory will be included in the build processes. Your main plugin file or theme functions file should be placed into this "src" folder.

PHP classes can be included under the "src/app" directory. PSR-4 autoloading of your own classes should be enabled by adding your namespace to the composer.json config as described here. The entire contents of the "src/app" directory will be copied to the build destination. All files/folders in the root "src" directory will also be copied, other than "src/scripts" and "src/styles" which are handled by their respective build processes. If you aren't using any vendor packages or PSR-4 autoloading classes, you can shorten build times by disabling the composer install task in your buildwp.config.js file.

composerInstall: false,

JS and CSS builds are handled very similarly. Any files in "src/scripts/index" or "src/styles/index" will be compiled by their respective build tools (esbuild or PostCSS). Folder structures under index directories will be respected in the output directory. Feel free to structure common or included files as you want outside of the index directories.

NOTE: Currently, the JS build task is not set up to support CSS-in-JS/importing CSS in javascript files.

Running "npx buildwp setup" also copies some build scripts into your root package.json file.

  • builds for development and watches everything in the "src" directory for changes
npm run dev
  • builds for production without watching
npm run prod
  • builds for production, then zips the "dist" directory in the correct folder structure for installation via wp-admin
npm run release

"npm run dev:local" and "npm run prod:local" scripts also are available to build directly to your local dev server, but you must first add your local plugin directory to the "buildwp.config.js" file. Example:

out: {
  dist: 'dist',
  // add path to your local dev server and plugin/theme file here
  local: '<path-to-local-wp-install>/wp-content/plugins/<your-project>',

UPDATE: String replacement is now supported on static files (PHP, readme, etc.). This allows you to replace hardcoded strings with placeholders that will be found and updated at build time. Handy for versions and other boilerplate data required by themes/plugins. For an example of pulling some of this info from the root package.json file, see the included example config file.

Roadmap

See the open issues for a list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Project Link: https://github.com/koehndesign/buildwp

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-beta.0

3 years ago

0.2.8-beta.1

3 years ago

0.2.8-beta.0

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.6-beta.6

3 years ago

0.2.6-beta.5

3 years ago

0.2.6-beta.4

3 years ago

0.2.6-beta.3

3 years ago

0.2.6-beta.1

3 years ago

0.2.6-beta.2

3 years ago

0.2.6-beta.0

3 years ago

0.2.5

3 years ago

0.2.3

3 years ago

0.2.4

3 years ago

0.2.3-beta.2

3 years ago

0.2.3-beta.1

3 years ago

0.2.3-beta.0

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago