Skip to content

Deploying your Theme to Production

Deploying a Hyvä theme requires building the production styles.css bundle.

The recommended steps to deploy a Magento theme to production are as follows.

The Build Environment

Where to build
We recommend building the styles.css as described below on a development, staging or build environment, instead of on the production host, because it requires a node.js installation.

As a rule of thumb, build tools should not be installed on a production environment as a security consideration.

Automated builds
If you run an automated CI pipeline, use npm ci instead of npm install to install the tailwind dependencies.

The reason is that npm install might install newer package versions, while npm ci gives you a repeatable build with the exact package versions listed in package-lock.json file.

1. Run npm run build-prod

Run npm run build-prod in your themes web/tailwind directory.
This command will generate the minified web/css/styles.css file in your theme.


Tip: You can use the --prefix argument to run this command from the Magento base directory:

npm --prefix app/design/frontend/My/theme/web/tailwind run build-prod

2. Run bin/magento setup:static-content:deploy

This step will copy the generated web/css/styles.css file into the pub/static/frontend/Your/theme/en_US/css/styles.css directory structure so it can be loaded by browsers with Magento running in production mode.
Note: the exact path depends on your theme and locale configuration and will be different from the example here.

3. Deploy to the production host

Deploy the pub/static/ directory to your production host.


Now visitors will see your updated theme.