UNPKG

483 BJavaScriptView Raw
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'use strict';
7
8exports.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};