Skip to content
Trellis
v1.23.0

Sage Integration

Trellis is designed to be theme-agnostic and is not tied to Roots' Sage theme at all. That doesn't mean it's hard though; all that's needed is a way to compile assets.

# Compiling production theme assets

Sage, like many WordPress themes now, requires a step during deploys to compile production assets.

Trellis includes an example build-before deploy hook designed to work with Sage. See deploy-hooks/build-before.yml. For Sage users, simply uncomment that built-in example hook file and deploy away. Assets will be compiled locally and then copied to the remote server.

# Other themes

The Sage example deploy hook can also serve as a blueprint for many other themes that need to run an npm or yarn command for compiling assets.

# NVM

If you use nvm to manage Node.js versions for running themes locally, the easiest way to use it is via $NVM_DIR/nvm-exec.

Example:

- name: Install npm dependencies
  command: $NVM_DIR/nvm-exec npm install
  delegate_to: localhost
  args:
   chdir: "{{ project_local_path }}/web/app/themes/mytheme"

- name: Compile assets for production
  command: $NVM_DIR/nvm-exec npm run build:production
  delegate_to: localhost
  args:
   chdir: "{{ project_local_path }}/web/app/themes/mytheme"

Contributors

Last updated

Support Roots

Help us continue to build and maintain our open source projects. We’re a small team of independent developers and every little bit helps.

Sponsor Roots on GitHub