Skip to content

Instantly share code, notes, and snippets.

@Thorsson
Forked from eric-hu/jst2haml.sh
Created February 15, 2012 13:09
Show Gist options
  • Save Thorsson/1835590 to your computer and use it in GitHub Desktop.
Save Thorsson/1835590 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