This is the official FSE theme used by Stuurlui, a WordPress comany from Utrecht. The project has been moved to a private GitLab repository.
For building assets we're using the official @wordpress/scripts
package from WordPress. We're tweaking it a little bit in our webpack.config.js
in order to have multiple blocks in our theme.
- In the root folder, run
npm install
- After installing, run
npm run start
- Webpack runs!
Usually blocks are supposed to be living in plugins. To accomodate them all in this theme, I've made a few tweaks in registering, compiling and loading blocks. In order to add one, there are a few simple steps:
- Add your block folder in
/blocks
and change the name on all occurances - Add the
index.js
entry point towebpack.config.js
- That's really all, everything else gets done automatically :)
For creating post types we use WP CLI. You can easily run wp scaffold post-type --prompt
from anywhere within your project, and your post type will be created after a few prompts in the terminal. All post types get their own file in the /post-types
folder and are easily extendible and automatically translatable.
We follow WordPress' best practices when it comes to block design. Furthermore we combine inner blocks with block wrappers. The default is to use template locking when deciding on blocks for templates, which can be done from the post type registration file.
We follow all coding standards as specified by WordPress. To enforce these standards we use the industry standard code linters.
For PHP we use the PHP Code Sniffer in combination with the WPCS configuration, as provided by WordPress. You can find the config in phpcs.xml
.
We also provide an editor config, found in the file .editorconfig
. It specifies tabs instead of spaces, and ensures linebreak consistency between operating systems.