1
0
mirror of synced 2025-12-20 10:28:40 -05:00
Files
docs/script/content-migrations/remove-html-comments-from-index-files.js
Kevin Heis 8a56437c93 Pretty format (#20352)
* Update prettier flow to include JS

* Run prettier

* ...run prettier
2021-07-14 14:35:01 -07:00

15 lines
486 B
JavaScript
Executable File

#!/usr/bin/env node
import fs from 'fs'
import path from 'path'
import walk from '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)
})