After installing the htmldocs package, you can start using the command line interface (CLI).
init
Initializes a new htmldocs project in the current directory.
login
Authenticates the CLI with the cloud. This allows you to publish your documents to the cloud.
dev
Starts a local development server that will watch your files and automatically rebuild your document template when you make changes. Login not required.
Options
Change the directory of your document templates.
Port to run dev server on
publish <file>
Publishes the document to the cloud for API use. Must be authenticated.
Options
The file path of the document to publish.
--help
Shows all available commands and options.
Options
Enable verbose logging
F.A.Q
How can I define props specific to the document's preview?
You can define preview props for your document by adding a PreviewProps
property to your default export. For example:
These props will be used when previewing the document in the development server.
How do I set up authentication for publishing?
To publish documents, you need to authenticate with the cloud service. Use the htmldocs login
command to start the authentication process. This will open a browser window where you can select a team and complete the authentication. Once authenticated, your tokens will be securely stored for future use.
Where are the built files stored?
By default, built files are stored in a dist
directory in your project root. You can customize this location by setting the NEXT_PUBLIC_USER_PROJECT_LOCATION
environment variable.