Skip to content

Instantly share code, notes, and snippets.

@eric-hu
Created October 21, 2011 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eric-hu/1303331 to your computer and use it in GitHub Desktop.
Save eric-hu/1303331 to your computer and use it in GitHub Desktop.
short shell script for converting jst.ejs files to jst.ejs.haml files for haml_assets
# bin/bash
# Converts jst.ejs files into jst.ejs.haml files
# Adapted from: http://shifteleven.com/articles/2008/06/08/converting-erb-to-haml-snippet
#
# Run this script from the root of your Rails project directory (or other language of your choice)
#
# It will output one line for each file it'll convert. Look the list over and verify that everything
# looks right. Once you're certain (I suggest doing a backup/git commit at this point), run:
#
# jst2haml | bash
#
# To remove old jst.ejs files, use
#
# find -iname *.jst.ejs
#
# Once again, look this over as a sanity check, then run:
#
# find -iname *.jst.ejs -delete
find . -name '*jst.ejs' | \
xargs ruby -e 'ARGV.each { |i| puts "html2haml --no-erb #{i} #{i.sub(/ejs$/,"ejs.haml")}"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment