Boilerplate aims to be compatible with a large range of PHP versions, however, still have modern tooling for developing a theme.
What's inside?
- Webpack - Module Bundler
- SASS - a CSS preprocessor
- Babel - JavaScript ES6 to ES5 compiler
- Stylelint - a SCSS linter
- Prettier - a SCSS linter
- ESLint - a JavaScript linter
Make sure you have:
Boilerplate follows a WordPress Minimal Requirements.
- Read the WordPress theme development guidelines
- Understand the WordPress template hierarchy
- Understand the WordPress Loop
- Understand how WordPress helps with Data Validation/Sanitization
- Read up on the following WordPress core APIs:
- Understand when you should use a Custom Functionality Plugin instead of implementing functionality within a theme
- This project uses webpack to provide support for modular JS, read up on the functionality & tools it provides
- The boilerplate assumes you are using SCSS to write your styles and compiles to CSS using Node Sass
- PostCSS is used to help you write modern CSS. PostCSS is a very popular tool that allows developers to write CSS pre-processors or post-processors using
Plugins
:- Autoprefixer is used for parsing and adding the correct vendor prefixes to the final generated CSS
- PostCSS Preset Env is used to let you convert modern CSS into something most browsers can understand, determining the polyfills you need based on your targeted browsers or runtime environments.
- CSS MQPacker is used to pack same CSS media query rules into one using PostCSS.
- CSSNANO is used to minify your CSS and makes code optimizations to have the least amount of code delivered in production.
- Avoid committing the built theme to the project repository
- Avoid committing the
wp-uploads
directory to the project repository - Avoid making changes directly to the built theme -- Always use the build process
- In production avoid uploading the theme development directory to a public server!
- It is good practice to enable
WP_DEBUG
in yourwp-config.php
file, but only during development. If you use our Vagrant Dev Environment setup, its already handled ;)
- Install WordPress and clear it of unnecessary default themes & plugins. If you use our Vagrant Dev Environment setup, skip this line.
- Clone/Download the contents of this repository into a directory in your WordPress
wp-content/themes
directory:$ git clone -b master git@github.com:code2gether/aylin-minimal-wordpress-theme.git # or if you want to change name of project when cloning it $ git@github.com:code2gether/aylin-minimal-wordpress-theme.git <my-theme-name> # without the arrows
- Open the terminal and navigate to the
my-theme-name
directory:cd wp-content/themes/my-theme-name/resources
- (Note: The next steps require nodejs and yarn)
- Run
yarn
to install all dev dependencies - Run
yarn build
to generate the "built theme" for the first time - Log in to the admin and enable the
my-theme-name
- Start Developing! 🎉
To begin developing your application, make sure you are in my-theme-name
directory:
- run
yarn start
to begin thedevelopment
build process that uses Browsersync, Webpack and Node SASS. - Develop your theme in the
resources/assets
and/my-theme-name
directories, thebuilt assets
will be generated bywebpack
intodist
directory - Optional Stuff:
- To install any dependency, use
yarn add <module(s)>
to easily manage JS dependencies, then useimport <module> from '<module>';
anywhere in your JS files you want to use them.
- To install any dependency, use
- Delete files you are not using from inside the
/my-theme-name
directory - Make sure to add a screenshot.png to your theme.
- Before deploying run
yarn build
to generate aProduction
ready version of the built theme - Deploy the built theme
dist
directory, not theassets
directory
resources/
|-- fonts/ # Custom typefaces goes here.
| |-- .gitkeep
|-- images/ # Put static images here.
| |-- .gitkeep
|-- scripts/ # Put JS scripts here.
| |-- main.js
|-- styles/ # Styles goes here.
| |-- helpers/ # Useful SCSS helpers
| |-- _global.scss # global style for theme
| |-- main.scss # Put your custom SCSS modules here
Great that you are considering supporting the project. You have a lot of ways to help us grow. We appreciate all contributions, even the smallest.
- Report an issue
- Propose a feature
- Send a pull request
- Star project on the GitHub
- Tell about project around your community
AYLIN is licensed under the MIT license.