Creating an efficient development workflow when building websites on the HubSpot CMS.
defaultPortal
to be your sandbox account, so when you run commands using the CMS CLI, it will automatically interact with your sandbox, and reduce accidental production deploys. At this point, your configuration file will look something like this:
hs upload
, if you do not specify a portal, the files will be uploaded to your “DEV” account.
hs theme preview
command in the theme’s root directory. This command will run a local proxy server at https://hslocal.net:3000/ which you can then use to preview the theme’s templates and modules. Learn more about the hs theme preview command.--portal
argument to interact with your production account, such as hs upload my-theme/src my-theme --portal=PROD
. When uploading files to your production account, pay attention if there were any errors to diagnose, and make sure to briefly browse your live website to make sure there were not any unintended consequences of the deploy.
If you work as part of a web development team, it is recommended to have your entire production codebase source of truth in version control, and to deploy to your product portal when changes are merged in master. This way, your team of developers can use your favorite version control system to collaborate, track changes and easily roll-back changes.
To learn more about setting up continuous integration with git repositories, follow this guide on utilizing GitHub actions to deploy to your production account when changes are merged into master.