1
0
mirror of synced 2025-12-21 02:46:50 -05:00

add script

This commit is contained in:
Sarah Schneider
2020-11-24 09:10:34 -05:00
parent c9293f4f90
commit 04235256af

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const walk = require('walk-sync')
const contentDir = path.join(process.cwd(), 'content')
// remove legacy commented out conditionals in index.md files
walk(contentDir, { includeBasePath: true, directories: false })
.filter(file => file.endsWith('index.md'))
.forEach(file => {
const newContents = fs.readFileSync(file, 'utf8')
.replace(/\n<!-- (if|endif) .*?-->/g, '')
fs.writeFileSync(file, newContents)
})