Skeleton for WordPress Plugin Boilerplate with Namespace and Gutenberg Block support
-
Rename files in:
/skeleton-gutenberg-blocks.php
/languages/plugin-text-domain.pot
-
Run Search Replace with Preserve Case:
- @plugin For Class Name
SkeletonGutenbergBlocks => YourPluginName
- @plugin For constants:
SKELETON_GUTENBERG_BLOCKS_ => YOUR_PLUGIN_NAME_
- @plugin For function names
skeleton_gutenberg_blocks to your_plugin_name
- @plugin For Text Domain
plugin-text-domain => your-plugin-text-domain
- @git_author For Github Author:
boospot => YourAuthorName
- @author For Author Name:
Rao => YourName
- @author For email:
[email protected] => YourEmail
- @link For Link:
https://booskills.com/rao => YourLink
- Update Plugin Comment Block in main file
/sgb.php
- @plugin For Class Name
-
After Adding more files as you go, use composer to update autoload if you need to. You shall need to have composer installed on your computer. In Terminal in the plugin directory, run following:
composer update
-
To install NPM dependencies, run the following command:
npm install
-
After doing all the magic of coding, run:
npm run build
-
While developing you may use the watcher by using the command:
npm run start
-
To Updates WordPress packages to the latest version:
npm run packages-update
-
Complete list of commands can be found here: https://www.npmjs.com/package/@wordpress/create-block
Once you have done all the build and plugin is ready to be released, you may follow these steps to issue the new plugin release:
-
Clone the repo toa new location probably your desktop:
git clone your_repo_link.git
-
Run Composer Update to build and install composer dependencies:
composer update
-
install npm modules and run build
npm install
npm run build
-
Once everything is built, you should remove the git directories, node_modules and other unnecessary directories:
find . | grep .git | xargs rm -rf
to remove all git related files and directoriesrm node_modules -r
to remove all node modules since these are not required after the build process is done.rm composer.lock
optionally remove composer lock filerm package-lock.json
optionally remove npm package lock file