Static HTML
Using the rsconnect CLI
This example command deploys a static HTML file to Posit Connect, assuming that we set up a server named myServer when configuring our account:
rsconnect deploy html -n myServer index.htmlDeploying a single HTML file
Specifying a file in the path results in that file, not the entire directory, being included in the deploy bundle.
e.g., using the following directory:
├─ my_project/
│ ├─ index.html
│ ├─ second.htmland the following command:
rsconnect deploy html -n myServer my_project/second.htmlwe get a bundle that includes second.html.
Deploying a directory containing HTML files
Specifying a directory in the path results in that entire directory, subdirectories, and sub contents included in the deploy bundle. The entire directory is included whether or not an entrypoint was supplied.
e.g., using the following directory:
├─ my_project/
│ ├─ index.html
│ ├─ second.htmland the following command:
rsconnect deploy html -n myServer my_projector, this command:
rsconnect deploy html \
-n myServer my_project \
-e my_project/index.htmlwe get a bundle that includes both index.html and second.html.
Specifying an entrypoint
Providing an entrypoint is optional if there’s an index.html inside the project directory, or if there’s a single HTML file in the project directory.
If there are multiple HTML files in the project directory and it contains no index.html, we will get an exception when deploying that directory unless an entrypoint is specified.
If we want to specify an entrypoint and we are executing the deploy command outside a project folder, we must specify the full path of the entrypoint:
rsconnect deploy html \
-n myServer my_project \
-e my_project/second.htmlIf we want to specify an entrypoint and we are executing the deploy command inside the project folder, we can abbreviate the entrypoint, like so:
cd my_project
rsconnect deploy html -n myServer ./ -e second.htmlIncluding extra files
If we want to include extra files in bulk to make them available when our HTML file is served by the Connect server, the directory deployment method mentioned above is the easier method. But if we want to to selectively add files to the deployment bundle, we can specify the extra files on the command line after the path:
e.g., using the following directory:
├─ my_project/
│ ├─ index.html
│ ├─ second.html
│ ├─ third.html
│ ├─ fourth.htmlcd my_project
rsconnect deploy html \
-n myServer \
index.html \
third.html \
fourth.htmlwe get a bundle that includes index.html, third.html and fourth.html.