NARKOZ NARKOZ - 1 year ago 115
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.

Answer Source

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__)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download