* Copy `templates/{dir}/**` ~> `${dest}/**` * @param {String} dir The "templates" dirname * @param {String} dest The target destination * @param {Object} data The data to inject
(dir, dest, data)
| 77 | * @param {Object} data The data to inject |
| 78 | */ |
| 79 | function copyDir(dir, dest, data) { |
| 80 | let cwd = join(templates, dir); |
| 81 | let isRaw = /svelte|vue|assets/i.test(cwd); |
| 82 | glob(cwd).forEach(({ rel, abs }) => { |
| 83 | let file = (isRaw || /index/i.test(rel)) ? join(dest, rel) : toAppFile(rel, dest); |
| 84 | let src = fs.readFileSync(abs, 'utf8'); |
| 85 | writer(file).end(templite(src, data)); |
| 86 | }); |
| 87 | } |
| 88 | |
| 89 | function copyFile(src, tar, name) { |
| 90 | let rr = fs.createReadStream(join(src, name)); |