UNPKG

mstr-viz

Version:

A new dev tool for creating custom visualizations

10 lines (8 loc) 352 B
const fs = require('fs-extra'); const _ = require('lodash'); module.exports = data => filePath => { const tmpl = fs.readFileSync(filePath, { encoding: 'utf-8' }); // set interpolate in order to ignore ES6 string template syntax const result = _.template(tmpl, { interpolate: /<%=([\s\S]+?)%>/g })(data); fs.writeFileSync(filePath, result); };