WordPress plugin for My Allocator channel manager
- Sass for stylesheets
- ES6 for JavaScript
- Webpack for compiling assets, optimizing images, and concatenating and minifying files
- Browsersync for synchronized browser testing
Make sure all dependencies have been installed before moving on:
Fork or clone repository in your local dir
yarn
— navigate to the plugin directory and run yarncomposer install
— Install composer dependenciesyarn run build
- Initial buildyarn run start
- 'Watch'
From the command line on your host machine (not on your Vagrant development box), navigate to the theme directory then run yarn
:
# @ wp-plugins/your-plugin-name/
$ yarn
You now have all the necessary dependencies to run the build process.
yarn run start
— Compile assets when file changes are made, start Browsersync sessionyarn run build
— Compile and optimize the files in your assets directoryyarn run build:production
— Compile assets for production
yarn run rmdist
— Remove yourdist/
folderyarn run lint
— Run ESLint against your assets and build scriptscomposer test
— Check your PHP for PSR-2 compliance withphpcs
To use Browsersync you need to update devUrl
at the bottom of assets/config.json
to reflect your local development hostname.
If your local development URL is https://project-name.dev
, update the file to read:
...
"devUrl": "https://project-name.dev",
...
If you are not using Bedrock, update publicPath
to reflect your folder structure:
...
"publicPath": "/wp-plugins/plugin-name/"
...
By default, Browsersync will use webpack's HMR, which won't trigger a page reload in your browser.
If you would like to force Browsersync to reload the page whenever certain file types are edited, then add them to watch
in assets/config.json
.
...
"watch": [
"assets/scripts/**/*.js",
"templates/**/*.php",
"src/**/*.php"
],
...