# How to best deploy to staging/production with Bedrock & Sage

**URL:** https://discourse.roots.io/t/how-to-best-deploy-to-staging-production-with-bedrock-sage/20448
**Category:** sage
**Tags:** sage9
**Created:** 2021-03-26T11:17:01Z
**Posts:** 5

## Post 1 by @MikeFishtank — 2021-03-26T11:17:01Z

So in my daily work we have to update or amend websites frequently.

We use GitBucket for our repos and have a cloud based WHM/cPanel hosting setup. We’re new to Sage and our normal process before sage was to locally work on the site running webpack etc and this would compile any SCSS and JS and update a build directory etc. We would then simply push our changes to the repo and then SSH into the staging/production and do a git pull.

With Sage 9 the _dist_ folder is ignored so doing this isn possible. I am currently doing what I feel is a backwards step…

After running **yarn build:production** locally I zip up the _dist_ folder which is added to the theme folder and commit/push to the repo which I then have to unzip to overwrite the existing _dist_ folder on staging/production after doing a git pull.

I’ve read the docs and search for better solutions but have found nothing that would make deploying to staging or production a easier/more normal process.

Does anyone else have a better way that would fit more closely to our original process?

---

## Post 2 by @strarsis — 2021-03-26T14:54:34Z

So you want to deploy on a shared hosting/non-VPS/non-Trellis system,

This theme zip build script for Sage 9 or 10 could be helpful:

> [@Deployment on Shared Hosting](https://discourse.roots.io/t/deployment-on-shared-hosting/20399/3):
>
> IMHO it could be quite helpful to add an “eject” task to Sage that automatically creates a minimal theme ZIP as build artifact. Note: node\_modules/ is only required for building the theme - it is not needed and should not be needed by the theme during runtime. If there are any files that should be available for the theme, either add them using webpack (e.g. imported SASS, url(...)) or copy them from node\_modules/ into dist/ or - for some cases - resources/. For Sage 10 themes: #!/bin/sh echo …

---

## Post 3 by @alwaysblank — 2021-03-27T05:37:22Z

If you’re using git to deploy, what’s stopping you from removing `dist` from `.gitignore` and committing your build artifacts? Sage’s only objection to that is philosophical; it should work with the process you describe.

---

## Post 4 by @MikeFishtank — 2021-03-29T11:32:40Z

Yeah that is a good option but locally when you run **yarn start** it generates a lot of development files that you wouldn’t want adding/committing to production.

---

## Post 5 by @alwaysblank — 2021-03-29T14:27:39Z

You wouldn’t commit the result of `yarn start`, you commit the the result of `yarn build:production`.

---

## Post 6 by @system — 2021-05-07T11:17:03Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
