Netlify’s configuration file, netlify.toml, allows you to define various settings for how your site will be deployed on Netlify.
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"
[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
[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.
Last updated January 23, 2021