Skip to content

donini/wordpress-automation

Repository files navigation

WORDPRESS-AUTOMATION

This can be called "framework" that create automations for some common tasks in WordPress projects. It turn more easer the developer's life.

Functions included:

All this options can be accessed by start menu.

Requirements

This libraries are required to run the automations, WP-CLI is required to run WordPress command line procedures, NodeJS is required to perform the GruntJS tasks such, wp-cli, hint javascript, generate sprites of images, live reload of project and SASS is required to perform pre-processing of css files.

Installation

After install all the requirements, type this command on terminal to install Gunt-CLI globally:

npm install -g grunt-cli

And then this to install node dependences and prepare boilerplate to use:

npm install

Commands

All commands must run on root folder:

Start menu

To show the start menu, type:

grunt

and select the option you want.

alt text

1) Download WordPress

This option will be download the lasted version of WordPress, if you want you can select the core language.

To initialize download, use:

grunt getwp

Parameters:

What is the language of WordPress you want?: default is en_US

alt text

2) Configure WordPress

This command just create the wp-config.php file with your settings.

To configure, use:

grunt configwp

alt text

Parameters:

Database: database name Database user: username of database Database password: password of user Database host: host of IP address Tables prefix host: default wpd_

3) Install WordPress

This command will be create the database and install WordPress with settings you entered in option 2.

To install, use:

grunt installwp

alt text

Parameters:

What is the address of your site? the url of of your project What is the title of your site? the title of your project (if title has spaces, use doublequotes) What is the name of admin user? the admin fo WordPress What is the password of the admin user? the password of admin user What is the email of the admin user? the e-mail of administrator

4) Update WordPress

This command update the core WordPress of your project.

To update, use:

grunt updatewp

5) Create new theme [DEVELOPMENT]

To create a new custom theme, use:

grunt create        [OR]        grunt c

alt text

Parameters:

Theme name: the name of your theme/project Project code: the code of your project1

Observations:

1 This will be your url path to access project. Ex. http://localhost/PROJECT_CODE

6) Build Assets

To build all styles2, javascript, minify images and create sprite file, type this:

grunt buildAssets        [OR]        grunt ba

2 At this moment those files are not minified, it's just were unified.

Sub Commands

Build Styles

It's possible to build only the styles, this procedure will be process .scss files and unify all css results into a single file. To do this, type:

grunt buildStyle        [OR]        grunt bs
Build Scripts

It's possible to build only the javascript, this procedure will be unify all .js results into a single file. To do this, type:

grunt buildScript        [OR]        grunt bj

7) Deploy [PRODUCTION]

This command prepare the project to deploy into production server, it build3 everything and minify files, type:

grunt deploy        [OR]        grunt d

alt text

Parameters:

Deploy url: the final url of your project Deploy database: database name Deploy database user: username of database Deploy database password: password of user Deploy database server: host of IP address

3 The result of the compilation will be found 'build' folder at root, this contains WordPress files and an dump of database. The source files (of assets) will not be sent to this folder.

8) Change version

It's possible to controll4 the versions of your theme/project, type:

grunt changeVersion        [OR]        grunt cv

4 Using this you prevent cache in assets files after each new deploy.

9) Watch

This is one of the collest features of this framework, this command observing files changing and build all assets and tiggers refresh to the browser automatically, type:

grunt watch        [OR]        grunt w

5 Watch command observe changes only in .scss, .js, .php, .html, .png, .gif, .jpg files.

Framework features

Suggest new features and register issues

Use the Issues menu of this repository to register issues, doubts and suggest new features.

See changelog of project.