Include a partial file only during the build process

Hello there,

I’m trying to figure out the best way to add a partial only when “building” the site.

After some meditation, I arrived to the conclusion to create variable in the config.rb file in the :build block

configure :build do
  set :includefile, true
end

At this point, add an if condition in the footer to check the variable value will give me the opportunity to include the file whenever necessary.
During the dev mode (middleman server running) this variable won’t exist or it can be set to false, hence the file won’t be included. During the build process the file will be included.

Is this the best approach?

Thanks
Andrea

See build?.