0

I'm trying to create some scaffolding tool to easily start a project the way I want. I like the way how guys from moleculer do it in their https://github.com/moleculerjs/moleculer-cli

They use Handlebars so now I can do this in my template (for example the one for package.json):

"name" : "{{ projectName }}"

That worked well but I would prefer to use ejs. Unfortunately, I can't figure out how to successfully change the init.js file so Metalsmith can chew up something like this:

"name" : "<%= projectName %>}}"
daremes
  • 15
  • 6

1 Answers1

0

The moleculer-cli uses consolidate package which supports ejs, as well.

So, you should change the render variable here: const render = require("consolidate").handlebars.render;

Icebob
  • 1,132
  • 7
  • 14
  • thank you very much, icebob...silly me, that works like a charm. `const { render } = require('consolidate').ejs` does the trick. then i just changed regex test inside init.js to `/<%=([^]+)%>/` to fit ejs pattern. thanks again. – daremes Jul 19 '19 at 13:56