Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const FILEPATH = './file/to/template.hmtl';
- const fs = require('fs');
- const s = fs.readFileSync(FILEPATH, 'utf-8');
- const vars = Array.from(
- new Set(
- s
- .match(/{{([a-zA-Z0-9]+}})+/g)
- .map(x => x.match(/{{([a-zA-Z0-9]+)}}/)[1])
- )
- );
- console.log(vars.sort().join('\n'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement