gulp-template icon indicating copy to clipboard operation
gulp-template copied to clipboard

SyntaxError: Unexpected token .

Open cyberz opened this issue 7 years ago • 3 comments

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)

cyberz avatar Feb 23 '18 14:02 cyberz

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.

jespersoderlund avatar Mar 05 '18 16:03 jespersoderlund

try with evaluate : false ` .pipe(template(options.variables, { interpolate: /{{([\s\S]+?)}}/g, escape: /<%-([\s\S]+?)%>/g, evaluate: false, } ))

`

MaximBelov avatar Jun 11 '18 20:06 MaximBelov

@cyberz did you ever figure out a solution for this?

JacobDB avatar Sep 30 '18 05:09 JacobDB