DEV Community

Ankur Sheel
Ankur Sheel

Posted on • Originally published at ankursheel.com on

How to override the netlify build config

Problem

As part of the migration from Gatsby to Statiq, I wanted to keep the original site running with gatsby but deploy the new branch using Statiq.

Solution

First, we need to allow branch deploys for our branch.
Netlify UI

In the above screenshot, my branch for the migration is named statiq.

To override the build settings set in the Netlify UI, we can add the following snippet to netlify.toml

[build]
  command = "dotnet run --project ./subDir/"
  publish = "./subDir/output"
Enter fullscreen mode Exit fullscreen mode

So, what’s happening here?

  • Line 1 : Apply the build settings globally and override anything set in the UI.
  • Line 2 : Use the dotnet run as the build command and specify the project path.
  • Line 3 : The relative directory to the root directory containing the deploy-ready HTML files and assets.

Conclusion

The advantage of updating the netlify.toml file is that when we merge our branch back to master, it will automatically use Statiq to build the site.

References:

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay