Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #111 from jannon/RailsTagPlugin

A plugin that removes <%…%> tags from .erb files
  • Loading branch information...
commit 92fc3ff4fc1cd41fb7f3b09f6c19170f83f7d2cf 2 parents 544f612 + 0aaee99
Jannon Frank authored April 23, 2012

Showing 1 changed file with 20 additions and 0 deletions. Show diff stats Hide diff stats

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

0 notes on commit 92fc3ff

Please sign in to comment.
Something went wrong with that request. Please try again.