UNPKG

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