I'm working on my first Yeoman generator and need to output some literal ejs tags for later processing. I'm able to achieve this by escaping the tag with an additional '%' per the ejs docs (http://ejs.co/). For example:
<%% myModule %>
I can process this without issue using the deprecated generator.template(), and the destination file contains the expected output:
<% myModule %>
However, when I attempt to use generator.fs.copyTpl() to process the same file, I get the following synthax error:
SyntaxError: Unexpected token %
Do I need to explicitly pass an escape character in the ejs options object? Is there something else I'm missing?
Any ideas? Thank you!
Using <%%
just works with ejs and yeoman-generator.
My guess is that you're not using the latest version of yeoman-generator
.
Run this in your generator project:
npm install --save yeoman-generator@LATEST
Also, there's a useful tool called david to detect outdated dependencies.
npm -g install david
# Then in your project folder
david
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With