railsTemplate.js.erb 416 B

12345678910111213141516171819
  1. /**
  2. * Strips the rails template tags from a js.erb file
  3. *
  4. * @module plugins/railsTemplate
  5. */
  6. exports.handlers = {
  7. /**
  8. * Remove rails tags from the source input (e.g. <% foo bar %>)
  9. * @param e
  10. * @param e.filename
  11. * @param e.source
  12. */
  13. beforeParse: function(e) {
  14. if (e.filename.match(/\.erb$/)) {
  15. e.source = e.source.replace(/<%.*%> /g, "");
  16. }
  17. }
  18. };