gulp-template
gulp-template copied to clipboard
SyntaxError: Unexpected token .
On js file with size 4.2 Mb
events.js:183
throw er; // Unhandled 'error' event
^
SyntaxError: Unexpected token .
at Function (<anonymous>)
at C:\projects\123\node_modules\lodash\lodash.js:14843:16
at apply (C:\projects\123\node_modules\lodash\lodash.js:494:27)
at C:\projects\123\node_modules\lodash\lodash.js:15227:16
at apply (C:\projects\123\node_modules\lodash\lodash.js:496:27)
at C:\projects\123\node_modules\lodash\lodash.js:6600:16
at template (C:\projects\123\node_modules\lodash\lodash.js:14842:20)
at DestroyableTransform._transform (C:\projects\123\node_modules\gulp-template\index.js:22:16)
at DestroyableTransform.Transform._read (C:\projects\123\node_modules\readable-stream\lib\_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (C:\projects\123\node_modules\readable-stream\lib\_stream_transform.js:170:83)
at doWrite (C:\projects\123\node_modules\readable-stream\lib\_stream_writable.js:406:64)
at writeOrBuffer (C:\projects\123\node_modules\readable-stream\lib\_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (C:\projects\123\node_modules\readable-stream\lib\_stream_writable.js:322:11)
at write (C:\projects\123\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:623:24)
at flow (C:\projects\123\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (C:\projects\123\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:664:5)
I get the same thing. This is in my case down to trying to templatize a non-HTML file (YAML) seems like the underlying template engine is not agnostic about the content.
try with evaluate : false ` .pipe(template(options.variables, { interpolate: /{{([\s\S]+?)}}/g, escape: /<%-([\s\S]+?)%>/g, evaluate: false, } ))
`
@cyberz did you ever figure out a solution for this?