January 23, 2021
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.
A quick favor: was anything I wrote incorrect or misspelled, or do you still have questions? Please use this form to let me know or ask for help!