Skip to main content
The commands below allow you to interact with the CMS using the HubSpot CLI, providing the ability to upload and manage files in the Developer File System, manage your themes, and more.
As of version 8.0.0 of the CLI, all CMS-related commands have been reorganized under the hs cms namespace. Old commands (e.g., hs upload, hs fetch, etc) are no longer supported and you must use the new hs cms equivalent commands instead (e.g., hs cms upload, hs cms fetch, etc).Learn more about these changes on the HubSpot Developer Changelog.

Create a CMS app

Create a new CMS app with a boilerplate directory structure to support specific features.
Arguments Flags

CMS serverless functions

The commands below allow you to serverless functions in a CMS app.

Create a CMS serverless function

Create a new serverless function in a CMS project.
Arguments Flags

List CMS serverless functions

List currently deployed serverless functions in a CMS project.

View CMS serverless function logs

Review logging for a specific CMS serverless function.
Arguments Flags

Interacting with the developer file system

Using the CLI, you can interact with the developer file system, which is the file system in the Design Manager. These commands enable you to create new assets locally, such as modules and themes, upload them to the account, list files in the HubSpot account, or download existing files to your local environment. To upload and download files from the files tool instead, learn more about files tool commands.

List files

List files stored in the developer file system by path or from the root. Works similar to using standard ls to view your current directory on your local machine.
Arguments

Fetch files

Fetch a file, or a directory and its child folders and files, by path. Copies the files from your HubSpot account into your local environment. By default, fetching will not overwrite existing local files. To overwrite local files, include the --overwrite flag.
Arguments Flags

Upload files

Upload a new local asset to your HubSpot account. Changes uploaded through this command will be live immediately.
Arguments Flags
Please note: if you use the --clean flag, any associated global content configured using the global content editor will be reset to the defaults defined in your global partials.
To upload files to your account’s files tool (not the Design Manager), use the hs filemanager commands. Learn more.

Set a watch for automatic upload

Watch your local directory and automatically upload changes to your HubSpot account on save. Any changes made when saving will be live immediately. Keep the following in mind when using watch:
  • Deleting watched files locally will not automatically delete them from HubSpot. To delete files, use --remove.
  • Renaming a folder locally will upload a new folder to HubSpot with the new name. The existing folder in HubSpot will not be deleted automatically. To delete the folder, use --remove.
Arguments Flags

Move files

Moves files within the developer file system from one directory to another. Does not affect files stored locally.
Arguments Flags

Delete files

Deletes files, or folders and their files, from your HubSpot account. This does not delete the files and folders stored locally.
Arguments Flags

Ignore files

You can include a .hsignore file to specify files that should not be tracked when using the CLI. This file functions similar to how .gitignore files work. Files matching the patterns specified in the .hsignore file will not be uploaded to HubSpot when using the upload or watch commands.
By default there are some rules HubSpot automatically enforces. There is no way to override these defaults.The following are always ignored:
  • hubspot.config.yml/hubspot.config.yaml
  • node_modules - dependencies
  • .* - hidden files/folders
  • *.log - NPM error log
  • *.swp - Swap file for Vim state
  • Icon\\r - Mac OS custom Finder icon
  • __MACOSX - Mac resource fork
  • ~ Linux Backup file
  • Thumbs.db - Windows image file cache
  • ehthumbs.db - Windows folder config file
  • Desktop.ini - Windows custom folder attribute information
  • @eaDir - Windows Synology diskstation “hidden” folder where the server stores thumbnails.

Convert JavaScript fields to JSON

Save the output of a JavaScript fields file as fields.output.json in the same directory as the JavaScript fields file.
Flags

Lint a local directory

Validate the contents of a directory in your CMS project.
Arguments Flags

Create a module

Create a new module in your CMS project.
Arguments Flags

Create a theme

Create a new theme in your CMS project.
Arguments Flags

Locally preview theme

When developing a theme, you can run hs cms theme preview in the theme’s root directory (src/theme/my-theme/) to render a live preview of your changes without uploading files to the account. Once run, this command will run a watch process so that any saved changes are rendered in the preview.
Please note: to allow the local server to run on https, HubSpot must generate a self-signed SSL certificate and register it with your operating system. This will require entering your sudo password.
Arguments Flags The main page at https://hslocal.net:3000/ will display a list of your theme’s templates and modules, all of which can be individually previewed by clicking the provided links.
Screenshot of the hs cms theme preview local development server homepage

Evaluate themes and templates for SEO and accessibility

Uses Google’s Lighthouse tools to score the quality of your themes and templates for their adherence to the following categories:
  • Accessibility
  • Web best practices
  • Performance
  • PWA
  • SEO
The following types of templates are scored:
  • Landing pages
  • Website pages
  • Blog posts
  • Blog listing page
If any templates fail to generate a score because of Lighthouse errors, a list of these templates will be provided.
Flags

Retrieve an existing React theme

To fetch an existing React theme from your account, use the following command:
Arguments

Generate theme field selectors for in-app highlighting

When creating a theme, use the following command to generate an editor-preview.json file which maps CSS selectors to theme fields. This enables content creators to see which theme elements will be impacted by updates to a field’s styling options. After running the command, you’ll need to review and refine the editor-preview.json file to ensure that fields and selectors are mapped properly. While this command will make a rudimentary guess as to which fields affect which selectors, you’ll need to make corrections based on how your theme is built. For example, this command cannot detect when modules are overriding styling or when you’re using macros. Learn more about theme editor field highlighting.

Modes

The \--mode option allows you to determine if local changes are published when uploaded to HubSpot. This option can be used in each command or set as a default in your hubspot.config.yml file. The two options for \--mode are \--mode=draft and \--mode=publish. The following is the order of precedence for setting \--mode:
  1. Using \--mode in a command will override all other settings.
  2. Setting a defaultMode for each account in your hubspot.config.yml file, removes the need to use \--mode in each command. It will override the top-level setting.
  3. Setting a defaultMode at the top-level in your hubspot.config.yml file, sets a default\--mode for all accounts. It will override the default behavior.
  4. The default behavior for \--mode is publish.

Marketplace asset validation

The CLI provides a suite of automated tests you can perform on your assets to get them in-line with the marketplace requirements prior to submitting. Passing all automated tests does not mean you will for sure pass the review process, further review is conducted to ensure quality beyond what can be easily automated.

Validate theme

The theme validation command allows you to quickly run automated tests on your theme to identify problems that need to be fixed prior to submission to the asset marketplace. These will be returned in your CLI as a list of [error] and [success] messages separated into groups that represent types of assets within a theme. Before you can validate a theme, you’ll first need to upload it to your account with hs upload. Then, run the following command to validate the uploaded theme.
Arguments

Validate module

Similar to validating a theme, this command allows you to quickly run automated tests on a module to identify problems that need to be fixed prior to submission to the asset marketplace. Before you can validate a module, you’ll first need to upload it to your account with hs upload. Then, run the following command to validate the uploaded module.
Arguments

Create a webpack bundle

Create a new webpack bundle to support CMS serverless functions.
Arguments
Last modified on April 22, 2026