- Make sure that you have Acorn installed
- Install Sage using Composer from your WordPress themes directory (replace
your-theme-name
below with the name of your theme):
# @ app/themes/ or wp-content/themes/
$ composer create-project ravorona/sage your-theme-name
To install the latest development version of Sage, add dev-develop
to the end of the command:
$ composer create-project ravorona/sage your-theme-name dev-develop
themes/your-theme-name/ # โ Root of your Sage based theme
โโโ app/ # โ Theme PHP
โ โโโ Providers/ # โ Service providers
โ โโโ View/ # โ View models
โ โโโ filters.php # โ Theme filters
โ โโโ helpers.php # โ Global helpers
โ โโโ medias.php # โ Medias helper
โ โโโ setup.php # โ Theme setup
โโโ composer.json # โ Autoloading for `app/` files
โโโ public/ # โ Built theme assets (never edit)
โโโ functions.php # โ Theme bootloader
โโโ index.php # โ Theme template wrapper
โโโ node_modules/ # โ Node.js packages (never edit)
โโโ package.json # โ Node.js dependencies and scripts
โโโ resources/ # โ Theme assets and templates
โ โโโ fonts/ # โ Theme fonts
โ โโโ images/ # โ Theme images
โ โโโ scripts/ # โ Theme javascript
โ โโโ styles/ # โ Theme stylesheets
โ โโโ svg/ # โ Theme svgs
โ โโโ views/ # โ Theme templates
โ โโโ components/ # โ Component templates
โ โโโ forms/ # โ Form templates
โ โโโ layouts/ # โ Base templates
โ โโโ partials/ # โ Partial templates
โโโ sections/ # โ Section templates
โโโ screenshot.png # โ Theme screenshot for WP admin
โโโ style.css # โ Theme meta information
โโโ vendor/ # โ Composer packages (never edit)
โโโ vite.config.ts # โ Vite configuration
- Run
yarn
from the theme directory to install dependencies - Update
vite.config.ts
for bundler fine tuning
yarn dev
โ Start dev server and hot module replacementyarn build
โ Compile assetsyarn lint
โ Lint stylesheets & javascriptsyarn lint:css
โ Lint stylesheetsyarn lint:js
โ Lint javascripts
Add the following variables in your project .env
# Endpoint where the bundler serve your assets
HMR_ENTRYPOINT=http://localhost:5173
For advanced dev server configuration, copy .env.example
according
to Vite naming convention and loading order and update variables
Running HMR Mode remove the public/manifest.json
file, so do not forget to re-run the assets compilation
with yarn build
if needed.