Deployment
Stop
Before proceeding, read about how assets work.Build
To compile the assets for production, remove unneeded files (development only files) and compress the project for installation run the following command in command-line:
gulp build
Deployment result
Built projects are stored inside the/builds
folder and are compressed into ready-to-install zip packages. Assets located in /assets/js
and /assets/css
are minified, un-necesary root files are removed and vendor packages used only for development are excluded.
Versioning
Build (package) version can be defined in file package.json
. The version number is appended to the built zip file as a reference. Use Ayuco command set
to change the version of a project.
Custom Tasks
Custom gulp tasks can be added and executed throughout the deployment process. Custom tasks should be appended to the file gulpfile.js
(for more information read more about Gulp).
Custom tasks that are wanted to be run during build
must be added in the file package.json
.
{ // ... PACKAGE.JSON defined data // ... // "prestyles" is used to run tasks prior styles handling // In the sample below, SASS and custom task LESS are run. // SASS is ran by default. "prestyles": [ "sass", "less", "vendorcss" ], // "prescripts" is used to run tasks prior scripts handling. // In the sample below, custom task injected-js is run. "prescripts": [ "vendorjs" ], // "prebuild" is used to run tasks prior build task. // Default tasks are shown in the sample below. "prebuild": [ "scripts", "styles" ], // "prezip" is used to run tasks prior zip file is generated. // Default tasks are shown in the sample below. "prezip": [ "build-prezip", "jsmin", "cssmin" ], // "rootdirs" is used to defined which folders should remain on built zip. // In the sample below, WooCommerce customization is added. "rootdirs": "{app,assets,vendor,woocommerce}/**/*" }
Important notice
Not all tasks need to be filled, use only those needed. For more information about the deployment flow look at the gulp-wpmvc file.WordPress.org Plugins
The framework helps you develop and publish a public plugin at WordPress.org.
Your plugin needs to be approved prior to publication, generate an approval zip with command gulp build. Once WordPress.org has approved the plugin, follow the next steps to prepare your project for deployment:
Step 1: Create wordpress-org.json
Create a new .json
file at the root of your WPMVC project, name it wordpress-org.json
and fill it with the following information:
{ "root": "[plugin-name-path-given-by-wordpress.org]", "path": "[plugin-name-path-given-by-wordpress.org]", "cwd": "http://plugins.svn.wordpress.org/[plugin-name-path-given-by-wordpress.org]", "username": "[wordpress.org-username]", "password": "[wordpress.org-password]" }
NOTE: The username needs to have contributor permissions over the plugin
.
Step 2: Add your WordPress.org assets
Create and save your WordPress.org assets within your project, at the folder /assets/wordpress/
.
Step 3: Configure SVN
Download and install TortoiseSVN on your deployment machine.
Create the path [project]/svn/[plugin-name-path-given-by-wordpress.org]/
within your project.
Use TortoiseSVN to check out the plugin's WordPress.org repository at the recently created folder /svn/[plugin-name-path-given-by-wordpress.org]/
.
Step 4: Build the plugin with WPMVC
Load the wordpress-org.json
file into gulpfile.js
.
// Load wordpress-org JSON as config file. var wordpressOrg = JSON.parse(fs.readFileSync('./wordpress-org.json'));
Run command:
gulp wordpress
WPMVC will generate a clean build of the project (for production environment) inside the /svn/[plugin-name-path-given-by-wordpress.org]/trunk
path.
WPMVC will update WordPress.org assets inside the /svn/[plugin-name-path-given-by-wordpress.org]/assets
path.
Step 5: Push and release
Verify the build generate and use TortoiseSVN to add/commit your project into WordPress.org SVN.