NARKOZ NARKOZ - 12 days ago 4x
Ruby Question

Middleman: run custom action after build

How can I run custom action (eg. copy file to build folder) after middleman built pages?

I want to put
file from source to build dir.


You can use after_build hook. add following code to config.rb.

The hook which you can use is written in .

Although it is not well documented, it seems that after_build can use directly in config.rb, without writing your own extension.

after_build do |builder|
  src = File.join(config[:source],"")
  dst = File.join(config[:build_dir],"")
  builder.source_paths << File.dirname(__FILE__)