This is the WordPress block theme in use on my personal website itsamoreh.dev.
This theme was started from itsamoreh/block-theme-starter.
- Make sure you're on node version
18.12.1or later. - Run
npm installfrom this directory to install dependencies. - Run
npm run watchto watch CSS, and JavaScript. - Optionally follow the local environment instructions below to spin up a wp-env environment.
This theme uses PostCSS. The main CSS entrypoint is assets/main.css.
All CSS is imported in assets/js/editor/index.js and
assets/js/frontend/index.js, built with the rest of the build files then
enqueued in functions.php for both the editor and the frontend.
This theme uses wp-scripts to build editor and frontend JS. The main editor
entry is at assets/js/editor/index.js and the main frontend entry is at
assets/js/frontend/index.js. CSS is imported in the JS files.
To build the JS, run the following command in your terminal:
npm run build:jsThis will take the entry files, build them and all imports with wp-scripts, and
output the files to build/editor.js and build/frontend.js. To watch for
changes to your JS and automatically rebuild, run the following command in your
terminal:
npm run watch:jsThis theme includes a .wp-env.json. To spin up a WordPress environment with
wp-env first make sure
Docker is installed.
Then run the following command to start the environment:
npm run env:startYou can stop the environment with Docker Desktop or the stop command:
npm run env:stopSee the wp-env documentation for more details.
