forked from timber/starter-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Setup
James Macon edited this page Jun 6, 2024
·
14 revisions
Getting started you will need to install theme dependencies with nvm, npm, and composer.
- Navigate to the theme directory in your project folder.
- Run
composer scaffoldto pull the Base Build assets from the TS Base Assets repository. - Run
composer installto install Timber, Twig, and other dependencies in the theme. - Run
nvm useto ensure you're using the correct version Node (you might have to runnvm install 16to get this to run). - Run
npm ito install packages front-end dependencies and compile the initial set of tokens.
This theme has tailwindcss baked in. Tailwind will let you centralize your styling to the component Twig file with very little supporting css.
To get tailwind up an running you will need to compile its definitions. In the tokens directory you'll find JSON files that contain definitions for spacing, color palette, typography, and other global styles.
- Navigate to the theme directory in your project folder
- Modify the relevant design json files in
tokens/src. - Run
npm run format.tokens"to generate token files for Tailwind to use and compile from via webpack, compile styles to css, and begin watching CSS & Twig files for changes.
Advanced Custom Fields is a very helpful plugin for WordPress that lets you edit metadata on posts.
- Add the ACF repo to
composer.json
"repositories": [
...
{
"type": "package",
"package": {
"name": "junaidbhura/advanced-custom-fields-pro",
"version": "<version-number>",
"type": "wordpress-plugin",
"dist": {
"type": "zip",
"url": "https://www.advancedcustomfields.com"
},
"require": {
"junaidbhura/composer-wp-pro-plugins": "*"
}
}
}
...
]
- Add the package to requirements:
"require": {
...
"junaidbhura/advanced-custom-fields-pro": "<version-number>",,
...
}
- Replace
<version-number>with the correct version of ACF. - Run
composer updateto install.
- Building a flexible content system could benefit from this preview plugin:
"wpackagist-plugin/acf-flexible-content-preview":"1.0.6" - Flexible content systems play very well with Twig templates and the theme has a skeletal component to jump start implementation. This component uses the layout_name property from the ACF flexible content field to pull in a twig component with relevant template markup.
To start developing for the the theme you can run the webpack compiler for Twig, Sass, and JS using npm run start. If you're just editing PHP you do not need to run the compiler.