At 10up, we strive to provide digital products that yield a top-notch user experience. In order to improve both our efficiency and consistency, we need to standardize what we use and how we use it. This theme scaffold allows us to share initial set up procedures to make sure all projects can get up and running as quickly as possible while closely adhering to 10up's high quality standards.
- Node & NPM - Build packages and 3rd party dependencies are managed through NPM, so you will need that installed globally
- Gulp - Gulp is used as the main task runner, it runs PostCSS, processes images, handles SVG sprites (if needed), and executes Webpack
- Webpack - Webpack is used to process the JavaScript
- Composer - Composer is used to manage PHP.
Install 10up's command line tool for scaffolding new projects. You can download it from the Project Scaffold repository. Setting up a new theme is as easy as running create-10up theme theme-name-here
in the terminal!
Browsersync requires a local development URL. This is currently set in the package.json
, as proxyUrl
.
- Clone the repository
- Rename folder theme-scaffold -> your project's name
- If copying files manually to an existing theme directory instead of cloning directly from the repository, make sure to include the following files which may be hidden:
.babelrc
.browserslistrc
.editorconfig
.eslintignore
.eslintrc
.gitignore
The NPM commands will fail without these files present.
-
Do case-sensitive search/replace for the following:
- TenUpScaffold
- TENUP_SCAFFOLD
- tenup-scaffold
- tenup_scaffold
- 10up Scaffold
-
cd
into the theme folder -
run
npm run start
npm run start
(install dependencies and run initial gulp)
npm run watch
(watch)
npm run build
(build all files)
npm run deploy
(build all files for deploy)
npm run test-a11y
(run accessibility tests)
composer lint
(lint PHP files)
composer lint-fix
(lint PHP files and automatically correct coding standard violations)
The Theme Scaffolding ships with a default style guide you can find in /templates/page-styleguide.php
. This file contains all the basic HTML elements you would find at the very top of the cascade (headings, typography, tables, forms, etc.) These base elements will be styled and displayed as you naturally build out your CSS. The style guide also automatically pulls in the color variables used in the project. Any hex codes added into /assets/css/frontend/global/variables.css
will be automatically displayed in the style guide. To set up your style guide, you just need to create a new page in WordPress and assign it the "Style Guide" template.
If you need to update the core styles that power the style guide they are located in /assets/css/styleguide
and will naturally process with the rest of the CSS.
As your site grows you can add components to the style guide by updating /templates/page-styleguide.php
as you see fit. All the JS and CSS for the site will already be included in the template, so everything should just work.
Automated accessibility testing in the Theme Scaffolding is done with Pa11y and is executed with the command npm run test-a11y
. You can find any configuration options inside your package.json
file inside the testing
object. You will see default URL options (local, staging, production), but you can add as many as you'd like. The default script runs over the local
URL and any others will run with an argument like npm run test-a11y production
, over a production URL. You can also add more template URLs for testing like npm run a11y-test article-template
. Be sure to check with your systems person on a project to make sure accessibility tests are also hooked up through the deploy process.
Compliance levels can also be updated through the testing.accessibility.compliance
object in the package.json
file. The default is WCAG Level A, but it can be updated to anything listed in the pa11y documentation.
The test file lives in /tests/accessibility/compliance/pa11y.js
if any edits are needed (such as staging credentials, if you're running tests in an environment that requires authentication).
We don't know everything! We welcome pull requests and spirited, but respectful, debates. Please contribute via pull requests on GitHub.
- Fork it!
- Create your feature branch:
git checkout -b feature/my-new-feature
- Commit your changes:
git commit -am 'Added some great feature!'
- Push to the branch:
git push origin feature/my-new-feature
- Submit a pull request
- Babel core
- Babel eslint
- Babel loader
- Babel preset env
- Browsersync
- Can I Use DB
- Chalk
- Del
- Eslint
- Eslint loader
- Gulp
- Gulp CSSNano
- Gulp filter
- Gulp PostCSS
- Gulp Rename
- Gulp Sourcemaps
- Pa11y
- PostCSS CSSNext
- PostCSS Import
- Pump
- Require DIR
- Run Sequence
- Webpack
- Webpack CLI
- Webpack Stream
- Husky@next
- Lint Staged
- PHPCS