sindresorhus / gulp-template

Render/precompile Lodash templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ERROR in gulp-template] Unexpected token =

raDiesle opened this issue · comments

commented

Hi,

since ~ yesterday there seems to be a chance somewhere in the default interpolate syntax.
<%= "hi" %> does not work, <% "hi" %> is executed.
Our suspicion: gulp.utils version dependencies are fetching the newest versions.

By setting the interpolate/evaluate options, it works file.

Anyone experienced the same issues ?

Can you try deleting the node_modules folder and running npm cache clean and then npm install?

Hi,
I have the same error, but @sindresorhus, your answer did not resolve it.

more precisely, I have Gulp installed globally (v3.8.8), and gulp-template locally in node_modules (v1.1.0)
I have this exact error:

events.js:72
throw er; // Unhandled 'error' event
^
SyntaxError: Unexpected token =
at Function ()
at template (__/node_modules/lodash/dist/lodash.js:6305:22)
at DestroyableTransform._transform __/node_modules/gulp-template/index.js:24:31)

hope this helps

@t1st3 You have an unhandled error. Handle it to see it like explained here #9 (comment)

@sindresorhus, thanks, that helped (mostly to understand that the problem is related to Lodash templates).
While reading http://lodash.com/docs#template, I noticed that I could do:

<% print(name) %>

rather than:

<%= name %>

That solved the problem, but I still can't figure why the 2nd doesn't work.
Thanks anyway.