pluma/literalify

In React-Router 1.0 there is a special strings enclosed in grave accent --> ` which fail

Closed this issue · 1 comments

React-Router 1.0 introduce 'back-ticks' to represent dynamic expressions; like:

{author.id}

which is going to be translated by:

React.createElement(Link, {to: author/${author.id}}

When literalify attempt to process the file the error:

Unexpected character '`' (25:68) (while literalify was processing ....

How we can fix this module to ignore backticks, I mean interpret as simply string quotes.

Sorry, this is not really a bug, To avoid this error we have to apply "es6-template" transformation before apply literalify in order to compile "string templates". like:

es6template = require("es6-templates");

gulp.task('react:js', function () {
return gulp.src(paths.areas_mainjs)
.pipe(browserify({
debug: true,
extensions: ['.jsx', '.js'],
transform: [reactify, es6template, literalify.configure({
'lodash': 'window._',
'react': 'window.React',
'react-dom': 'window.ReactDOM',
'react-router': 'window.ReactRouter',
})]
}))
...................