Boilerplate code and Style Guides for STAT development.
JavaScript modules and jQuery plugins follow our modified version of the WordPress JS standards. We lint these files with JSCS. (See .jscsrc
in this repo, as well as the WordPress JSCS config.) JavaScript code should also pass a basic JSHint check. We also recommend using JavaScript's strict mode.
The jQuery plugin skeleton is based on jQuery Boilerplate. The JavaScript module skeleton uses the revealing module pattern along with a statGlobal
namespace.
PHP code follows the "WordPress Extra" standards and is linted with PHP_CodeSniffer. (See the code standards themselves and the documentation for the standards for more fun reading).
Stylesheets follow our Sass/CSS style Guide. This guide is loosely based on SMACSS and Mark Otto's article on Nesting in Sass and Less.
- Add CommonJS wrapper, and only use statGlobal if no module loader is available.
- Switch to ES6, and replace constant naming convention with the actual
const
keyword. - Use Pugin to simplify the creation of jQuery plugins.
- Demonstrate use of singleton pattern in ES6.