Skip to content

Expert Answers to Your Magento, Shopify & Shopware Questions

Vendor-neutral, engineer-written explanations. Clear definitions first, then practical steps with real examples — no fluff.

Stagebit builds and maintains stores on Magento, Adobe Commerce, Shopify, Shopware, and Laravel, and this library holds the questions our own engineers get asked most often on each platform.

How do I configure Hyvä builds per environment for dev, staging and production?

SB
Written by Stagebit Engineering Team
Updated November 2026 4 min read Verified by engineers

You set Hyvä builds per environment by changing the Tailwind CSS command, since the Hyvä Theme has no environment switch. Development runs npm run watch with Magento 2 in developer mode. Staging and production share one minified npm run build output that CI produces once and deploys unchanged to both.

Quick answer

For Hyvä builds per environment, run npm run watch only on developer machines, with Magento in developer mode. In CI, run npm ci and npm run build in your Hyvä theme’s web/tailwind folder to compile a minified styles.css. Then run bin/magento setup:static-content:deploy and deploy the resulting build unchanged to staging, then production. Keep Node.js off production unless you run Hyvä’s CMS Tailwind compiler daemon.

How Hyvä builds differ per environment

Only development compiles CSS continuously. Staging and production never run the theme’s Tailwind build themselves. Commands on this page match Hyvä’s documentation.

EnvironmentMagento modeTailwind commandWhere it runsNode.js on server
Developmentdevelopernpm run watchDeveloper machine or local DockerYes
Stagingproductionnpm run buildCI pipeline, never the serverNo, unless you run the CMS Tailwind compiler daemon
ProductionproductionNone for the theme buildReceives the staging artifact as isNo, unless you run the CMS Tailwind compiler daemon

How to configure Hyvä builds for each environment

Hyvä build pipeline: npm run watch in dev, one npm run build in CI, then the same build deployed to staging and production

Step 1: Keep development Hyvä builds on watch mode

Put Magento in developer mode so it serves theme files on demand. Then install dependencies once and start the watcher from the theme’s Tailwind folder.

bin/magento deploy:mode:set developer
cd app/design/frontend/Vendor/theme/web/tailwind
npm ci
npm run watch

The watcher rewrites web/css/styles.css each time you save a template. On Hyvä 1.4 and later, npm start is an alias for the same command (see the Hyvä Tailwind build commands). For live reload, pass your local URL to browser-sync:

npm run browser-sync -- --proxy https://store.test

Keep that URL in the command or a local script. Each developer’s hostname differs, so it does not belong in committed config.

Step 2: Generate hyva-themes.json before any build

The app/etc/hyva-themes.json file tells Tailwind which modules to scan, including compatibility modules. Per Hyvä’s CI/CD guide, Hyvä 1.1.14 and newer regenerate it on setup:install, setup:upgrade, module:enable and module:disable. If your pipeline runs one of those before the CSS build, you’re covered. If your build runs without an installed Magento, generate the file locally and commit it:

bin/magento hyva:config:generate
git add app/etc/hyva-themes.json

If you skip this step, compat module classes can vanish from the staging build even though they worked locally.

Step 3: Run one Hyvä Tailwind build in CI

Your CI job produces the only CSS that staging and production will ever see:

npm --prefix app/design/frontend/Vendor/theme/web/tailwind ci
npm --prefix app/design/frontend/Vendor/theme/web/tailwind run build
bin/magento setup:static-content:deploy en_US

npm ci installs the exact versions in package-lock.json, so two runs on the same commit produce identical CSS. If the CI job has no database, commit a config.php you dumped locally with bin/magento app:config:dump. Running several Hyvä themes, for example one per store view? Repeat the Tailwind commands for each theme folder.

Older pipelines may still call npm run build-prod, the Hyvä 1.1.x command. Hyvä 1.4.0 removed that alias, so update those scripts before upgrading.

Step 4: Deploy the CI build to staging, then production

Deploy the CI build, compiled styles.css plus pub/static, to staging with MAGE_MODE set to production in app/etc/env.php. Test it there, then deploy that exact artifact to production. A second build could pick up a different module list or package version. At that point, staging no longer proves anything.

Building on a CI machine keeps Node.js off production, which the Hyvä production deployment docs recommend for security. The exception is the CMS Tailwind compiler daemon, which needs Node.js at runtime.

At release, run setup:upgrade only when setup:db:status reports pending changes:

if ! bin/magento setup:db:status; then
  bin/magento maintenance:enable
  bin/magento setup:upgrade --keep-generated
  bin/magento maintenance:disable
fi
bin/magento cache:flush

Hyvä builds on Adobe Commerce Cloud

On Adobe Commerce Cloud, Hyvä builds per environment run npm ci and npm run build inside a .magento.app.yaml build hook. The Tailwind build must finish before Adobe’s ECE-Tools runs static content deploy, or the stylesheet won’t ship. Cloud’s default allow-list .gitignore breaks Tailwind CSS v4 @source paths, and the Cloud build hook docs show the deny-list fix.

What breaks Hyvä builds between environments

  • Only npm run build produces the minified styles.css meant for production deploys, so never commit watch-mode output. Either gitignore it and build in CI, or commit only npm run build output.
  • A stale hyva-themes.json silently drops compatibility module styles from the staging build.
  • Classes used only in CMS blocks or admin content never appear in a template, so Tailwind purges them. Install Hyvä’s CMS Tailwind JIT module so those classes compile, as our answer on Hyvä CMS blocks explains. Its server-side setup runs a Node.js process, the CMS Tailwind compiler daemon.
  • Some pipelines ship only web/css/ and delete web/tailwind/. If you run the CMS Tailwind compiler daemon, keep each theme’s web/tailwind/ folder, minus node_modules/.
  • Hyvä 1.4.0 and newer need Node.js 20, and different versions on developer machines and CI can change output. Pin one version, for example with an .nvmrc file.
  • Using npm install in CI can pull newer packages than the ones you tested locally.

Recommended setup for Hyvä builds per environment

Think of Hyvä builds per environment as two modes: watch locally, build once in CI. Staging earns its place by running the exact CSS production will get. If your deploy script still runs npm on the live server, move that step into CI first.

For the Magento side of the pipeline, see our answer on running setup:upgrade and static content deploy in CI/CD. Our Hyvä theme development team can review your pipeline if staging and production CSS don’t match.

Was this answer helpful?

Your feedback helps us improve our answers.

Still need help?

Talk to our Hyvä experts

Stuck wiring Hyvä builds into your deploy pipeline? We can review your CI setup and close the gaps between staging and production.

Talk to Hyvä Experts