, 1 min read
Hosting Static Content with netlify.app
Original post is here eklausmeier.goip.de/blog/2020/05-27-hosting-static-content-with-netlify-app.
Many people associate netlify.com with its integration to GitHub, GitLab or Bitbucket. But you can just deploy your local files to Netlify as well.
Install netlify
command via npm install netlify-cli
. cd
to the directory where you locate your static content. Login to Netlify site via
netlify login
This will either directly open a browser, where you confirm the login, or enter your credentials. If the browser is not opened, then enter the URL given on console. Once you are logged in and have configured your domain name in the Netlify administration menu, you can deploy. For this run below command
netlify deploy --prod -d .
Netlify has the notion of two environments: preview and production. You can skip the preview environment and deploy directly to production.
The netlify command offers the following options.
$ netlify -h
Netlify command line tool
VERSION
netlify-cli/2.48.0 linux-x64 node-v13.13.0
USAGE
$ netlify [COMMAND]
COMMANDS
addons (Beta) Manage Netlify Add-ons
api Run any Netlify API method
build (Beta) Build on your local machine
deploy Create a new deploy from the contents of a folder
dev Local dev server
functions Manage netlify functions
help display help for netlify
init Configure continuous deployment for a new or existing site
link Link a local repo or project folder to an existing site on Netlify
login Login to your Netlify account
open Open settings for the site linked to the current folder
plugins list installed plugins
sites Handle various site operations
status Print status information
switch Switch your active Netlify account
unlink Unlink a local folder from a Netlify site
watch Watch for site deploy to finish
The netlify
script stores your credentials in $HOME/.netlify/config.json
.
The netlify deploy --prod .
command does not honor symbolic links. For example, symlinked images will not get uploaded.
My static site on netlify.app is here: klm.netlify.app.
Added 27-Oct-2024: Latest twist in command line trickery:
netlify deploy --prod -s klm .