Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"repository": "arbolista-dev/babel-plugin-react-templates",
"license": "MIT",
"main": "lib/index.js",
"contributors": [{
"name": "Eric Hulburd",
"email": "[email protected]"
}],
"contributors": [
{
"name": "Eric Hulburd",
"email": "[email protected]"
}
],
"author": {
"name": "Arbolista Development",
"website": "http://www.arbolista.mx"
Expand All @@ -17,14 +19,15 @@
"url": "https://github.com/arbolista-dev/babel-plugin-react-templates/issues"
},
"dependencies": {
"babel-cli": "^6.3.17",
"babel-core": "^6.5.2",
"babel-preset-es2015": "^6.3.13",
"babylon": "^6.3.0",
"react-templates": "0.5.x",
"escape-string-regexp": "^1.0.5",
"lodash": "^4.6.0",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"lodash": "^4.6.0",
"babel-cli": "^6.3.17",
"babel-core": "^6.5.2",
"babel-preset-es2015": "^6.3.13"
"react-templates": "0.5.x"
},
"devDependencies": {
"jasmine": "2.4.1"
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import reactTemplates from 'react-templates/src/reactTemplates';
import url from 'url';
import fs from 'fs';
import path from 'path';
import escapeRegExp from 'escape-string-regexp';

let DEFAULT_RT_OPTIONS = {
targetVersion: '0.14.0',
Expand Down Expand Up @@ -39,7 +40,7 @@ module.exports = function ({types: t}) {
enter(node_path, plugin) {
let relative_path = node_path.node.source.value,
ext = plugin.opts.ext || '.rt.html',
reg_ext = new RegExp(ext + '$');
reg_ext = new RegExp(escapeRegExp(ext) + '$');
if (reg_ext.test(relative_path)){
let compiled_path = fnCompiledTemplate(node_path, plugin, {
relative_path: relative_path,
Expand All @@ -61,7 +62,7 @@ module.exports = function ({types: t}) {
let args = node_path.node.arguments
if (args.length && t.isStringLiteral(args[0])){
var ext = plugin.opts.ext || '.rt.html',
reg_ext = new RegExp(ext + '$'),
reg_ext = new RegExp(escapeRegExp(ext) + '$'),
relative_path = args[0].value;
if (reg_ext.test(relative_path)){
let compiled_path = fnCompiledTemplate(node_path, plugin, {
Expand Down