Set *.haml to *.html (development) + *.cfm (build)

Hi, i’m building project with middleman and haml engine. In future i need let project run in coldfusion framework. however, in localhost i not have coldfusion, and just want to see in html file (middleman server with development mode) .
That’s not good if each time need to build file, i must rename all file from *.html.haml to *.cfm.haml then build command. I want have some kind of config in config.rb which setup way to insert file name extension for each mode.

Then, if “middleman build” ~> *.haml will compile to *.cfm
if “middleman server” ~> *.haml will compile to *.html

How can do it? or we still have not solution for this case ?

Thanks
Trung

Are the files identical, so that all you want to do is to have .cfm instead of .html on the built files?

In that case maybe the easiest way is to let after_build trigger a Ruby script that walks the built directory and renames the files.

Thankyou for you suggest!
I was prefer if Middleman can have build-in feature for this case because not everyone who use Middleman for their project is know well about Ruby and how to write this language :slight_smile: .
Anyways, i solved my issue, i post my way here to anyone stuck like me:
Put code into new file with name rename.rb (or other if you want):
Ruby code:

require 'find'
require 'fileutils'
class ReName < Middleman::Extension
  def initialize(app, options_hash={}, &block)
    super
    app.after_build do |builder|
      Find.find('build') do |path|
        if FileTest.file?( path )
          if path =~ /\.html$/i
            Dir.glob(path).each do |f|
                FileUtils.mv f, "#{File.dirname(f)}/#{File.basename(f,'.*')}.cfm"
            end
          end
        end
      end
    end
  end
end
::Middleman::Extensions.register(:rename, ReName)

use in config.rb
require ‘rename’
activate :rename # set this line into build prefix if you want. same with other extension

This code still not improve , many thank if someone can make it better.

Thankyou,
Trung