stx dev
Deploy a preview build and redeploy it as you edit.
Deploy a preview build of your documentation to Syntext, then watch your files and redeploy the preview each time you save. There is no local server — pages are built on Syntext's servers, so the preview renders exactly like production.
Usage
Options
| Flag | Alias | Type | Default | Description |
|---|---|---|---|---|
--dir <dir> | -d | string | . | Documentation directory |
--branch <branch> | string | dev | Branch name for the preview | |
--token <token> | string | Login token or project API key (overrides stx login) |
Examples
Start Preview
Deploys to https://dev--<slug>-docs.syntext.dev — for a project with the slug my-docs, https://dev--my-docs-docs.syntext.dev. With --branch, the branch name replaces dev; a very long branch name is shortened so the address stays valid (see Branch Preview). The command prints the URL to open.
How it works
File watching
stx dev watches:
docs/, or, when your pages sit next to syntext.json, the project folder (except node_modules/, .git/, build output and dot files)public/syntext.json, syntext.yaml, syntext.yml, stx.json, stx.yaml or stx.yml)openapi key names — or openapi.json, openapi.yaml or openapi.yml at the project rootEach preview uploads the same files as stx deploy; see What gets uploaded.
Changes are batched for 800 ms, then every file is uploaded again and the preview is rebuilt on the server. Refresh the page to see the new build.
Build errors
If a build fails, the spinner stops with the server's error message. The full build log is in the dashboard under Deployments. stx dev keeps watching, so the next save tries again.
Custom code in previews
CSS from _syntext/ and page css: files applies in the preview. Scripts and
head.html never run in previews, even when their switches are on, so when
your project has them stx dev prints:
See Previews.
Draft pages
draft: true works the same in a preview as in production: the page leaves the sidebar and is marked noindex, but its URL still opens.
Output
Each save prints a new Deployed line once the rebuild finishes.
Troubleshooting
No config
Run stx dev from the folder that holds your docs, or pass --dir.
Not Authenticated
Run stx login to authenticate with your Syntext account.
Not linked to a project
Link the folder with stx connect, or create and link a project with stx init --create.
File Changes Not Detected
If file watching stops working:
stx dev