Example setup of using Angular.js inside of a WordPress plugin to create a stand-alone, API powered, Angular.js single page app or micro site. The demo app includes the following concepts:
- Setup HTML5 pushState routing
- Create custom API endpoints that are consumed by Angular's
$resource
service - Build LESS, JS and dynamic HTML with a gulp build
- Auto-version CSS and JS inside of a dynamic HTML template (using Gulp)
- How to handle it all inside of an isolated WordPress plugin
Make sure you have node
, npm
, and gulp
packages installed globally then:
- Clone the repo to your
/wp-content/plugins/
directory - Install Node packages for the build process:
npm install
- Run the Gulp build:
gulp build
- Activate the WordPress Angular Plugin Demo plugin within WordPress
Gulp is used to compile, concatenate, and minify LESS and JS for the plugin.
gulp
- Watch tasks that will compile when JS/LESS files change in real-timegulp build
- Compiles all JS/CSS then exits.