December 18, 2019
Netlify's configuration file, netlify.toml, allows you to define various settings for how your site will be deployed on Netlify.
A basic netlify.toml
file (placed at the root directory of your project) for a Gatsby site looks like this:
[build]
command = "gatsby build"
publish = "public"
[dev]
command = "gatsby develop"
The first [build]
block tells Netlify that they should run gatsby build
on their servers whenever you publish a new version of the site, and then publish whatever Gatsby puts in the public
folder.
The second [dev]
block tells Netlify that it should run gatsby develop
whenever you run netlify dev
on the command line to develop locally. Why use netlify dev
instead of gatsby develop
, the normal way of starting Gatsby's development server? Running Gatsby's command through Netlify Dev allows you to emulate the final Netlify site more closely. This includes:
There's a lot more you can configure in your netlify.toml
file, such as environment variables, redirects, headers, and image compression. More information is in Netlify's documentation.
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!