Skip to content

Instantly share code, notes, and snippets.

@SorenPeterson
Created March 27, 2015 18:27
Show Gist options
  • Save SorenPeterson/a83020ec00d7e7d54cea to your computer and use it in GitHub Desktop.
Save SorenPeterson/a83020ec00d7e7d54cea to your computer and use it in GitHub Desktop.
A small ruby script to precompile handlebars file. Note: files must be named with extension .hbs
files = `ls`
files = files.split("\n")
files = files.select do |filename|
filename =~ /\A\w+.hbs\z/
end
files.each do |filename|
new_filename = filename.gsub(/\A(\w+).hbs\z/, '\1.tpl.js')
`handlebars #{filename} -f #{new_filename}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment