Velo: Working with the Wix CLI

The Wix CLI is a tool that allows you to work with your Wix site from your computer's terminal.

Set up the Wix CLI

The CLI is an npm or yarn package that you install on your computer. Before setting up the CLI, make sure your site is connected to GitHub and your site's repository is cloned on your computer.

  1. Open your computer's terminal.

  2. Run npm install -g @wix/cli or yarn global add @wix/cli.

    Once you've installed the CLI globally, you can use it with any Wix site repos on your computer.

Commands

The CLI supports the following commands:

wix -h

Displays a list of supported CLI commands in the terminal.

Copy
1
wix -h
2
3
Usage:
4
wix [options] [command]
5
6
Commands:
7
dev [options] Open the Local Editor that runs your local code
8
install [options] <package> Install a supported Velo package
9
update [options] <package> Update a Velo package
10
uninstall [options] <package> Uninstall a Velo package
11
publish [options] Publish your site to production
12
preview [options] Create a shareable version of your site before going live
13
login [options] Log in to your Wix account
14
whoami [options] Display the username of the logged in Wix user
15
logout [options] Log out of your Wix account
16
17
Options:
18
-v, --version Output the version number
19
-h, --help Display help for command

You can also run wix [command] -h to get detailed help for a command.

wix dev

Opens a site's Local Editor.

Copy
1
wix dev

For more information, see Working with the Local Editor.

wix install

Installs a code package to a site's repo.

Copy
1
wix install [options] <package-name>

If your site's repo has a yarn.lock file, the installer uses yarn to install packages by default. Otherwise, the installer uses npm by default. To specify which package manager to use, include an --npm or --yarn options flag.

Example install command:

Copy
1
wix install --yarn marked

Once the package is installed, a message is displayed in the terminal.

Copy
1
marked@4.0.16 successfully installed.

wix update

Updates a code package that's installed on a site's repo.

Copy
1
wix update [options] <package-name>

wix uninstall

Uninstalls a code package from a site's repo.

Copy
1
wix uninstall [options] <package-name>

wix publish

Publishes a site.

Copy
1
wix publish

You can choose to use either the code in the default branch of a site's repo or the local code on your computer as the publishing source.

Copy
1
? What would you like to publish? › - Use arrow-keys. Return to submit.
2
❯ Latest commit from origin/main
3
Local code

Important: Publishing your local code leaves your live site and your site's GitHub repo out of sync. If you publish from the repo later without pushing your local code, your local code is overwritten and may be lost.

For more information, see Publishing a Site with the Git Integration & Wix CLI.

wix preview

Builds a preview version of a site. You must first publish your site before running this command.

Copy
1
wix preview

You can build the preview from the code in the default branch of a site's repo or from the local code on your computer.

Copy
1
? What would you like to preview? › - Use arrow-keys. Return to submit.
2
❯ Latest commit from origin/main
3
Local code

Once the preview site is ready, a URL to the site is displayed in the terminal.

Copy
1
Creating preview deployment...
2
3
Your preview deployment is now available at http://wix.to/JOaBagO

Note:

  • This preview isn't a test site and doesn't appear in the Release Manager.
  • The preview uses the live versions of any HTTP functions exposed on your site. This means you can't use the preview to test changes to HTTP functions. To test HTTP functions, commit and push them to your site's repo and use functional testing in the editor.

wix login

Logs in to a Wix account. This allows the CLI to perform actions on that account's sites.

Copy
1
wix login

When you run the command, the Wix login page opens in your default browser.

wix whoami

Displays the username of the currently logged in Wix user.

Copy
1
wix whoami

wix logout

Logs out of a Wix account.

Copy
1
wix logout
Was this helpful?
Yes
No