Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const ejs = require('ejs')
- // Pleb way
- ejs.fileLoader = loadFile;
- function loadFile(filePath) {
- const regex = /^[ \t]*#(.*)$/mg;
- const contents = fs.readFileSync(filePath);
- return contents.replace(regex, '<%_$1_%>');
- };
- // l33t hacker way
- ejs.fileLoader = (p) => fs.readFileSync(p).replace(/^[ \t]*#(.*)$/mg, '<%_$1_%>');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement