How do I configure Hyvä builds per environment for dev, staging and production?
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.
| Environment | Magento mode | Tailwind command | Where it runs | Node.js on server |
|---|---|---|---|---|
| Development | developer | npm run watch | Developer machine or local Docker | Yes |
| Staging | production | npm run build | CI pipeline, never the server | No, unless you run the CMS Tailwind compiler daemon |
| Production | production | None for the theme build | Receives the staging artifact as is | No, unless you run the CMS Tailwind compiler daemon |
How to configure Hyvä builds for each environment

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 buildproduces the minifiedstyles.cssmeant for production deploys, so never commit watch-mode output. Either gitignore it and build in CI, or commit onlynpm run buildoutput. - A stale
hyva-themes.jsonsilently 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 deleteweb/tailwind/. If you run the CMS Tailwind compiler daemon, keep each theme’sweb/tailwind/folder, minusnode_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
.nvmrcfile. - Using
npm installin 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.
Related 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.