const fs = require('fs'); const path = require('path'); const words = fs.readFileSync(path.resolve(__dirname, './words.txt'), 'utf8').split('\n'); for (const word of words) { const filePath = path.resolve(__dirname, '../replace/', `./${word}.md`); fs.writeFileSync(filePath, `\ --- layout: replace title: ${word} type: 'Anything, really' --- # ${word} ${word} is really cool dude `); console.log(`wrote ${word}.md`); }