I’m working in a similar environment right now, the build folder is used for the backend integrator as templates. It’s quite a bit of javascript in there (written in Coffeescript) so they asked for a non-minified, non-concatenated copy in a separate folder to get a better overview.
I have the coffeescript files lined up in a folder and use sprockets to concatenate them all, the coffeescipt files all start with a “", so Middleman is ignoring them.
In my case I just removed the "” prefix from my coffeescript assets and I had a separate folder in build with all the original js modules in it.
I’m not sure if this is helpful as I don’t know your exact use-case for that extra JS folder.
P.S.: Middleman also has an “after_build” hook, used by e.g. middleman-sync, but I’ve never utilized it for anything.
P.P.S: For the same project, I wrote a little helper to post-process my assets. It was a requirement for the client all assets come with tabs instead of spaces (gasp!).
require 'find'
module ConvertToTabs
class << self
def registered(app)
app.after_build do |builder|
Find.find('build/') do |item|
next if item == '.' or item == '..'
if File.extname(item) == '.html' || File.extname(item) == '.css' || File.extname(item) == '.js'
content = File.open(item, "r") { |f| f.read }
content = content.gsub(/^( {2})+/) { |spaces| "\t" * (spaces.length / 2) }
File.open(item, "w+") { |f| f.write(content) }
end
end
end
end
alias :included :registered
end
end
::Middleman::Extensions.register(:convert_to_tabs, ConvertToTabs)
It’s activated in config.rb like this:
require 'helpers/convert_to_tabs.rb'
configure :build do
[...]
activate :convert_to_tabs
end