add script
This commit is contained in:
15
script/content-migrations/remove-html-comments-from-index-files.js
Executable file
15
script/content-migrations/remove-html-comments-from-index-files.js
Executable 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)
|
||||
})
|
||||
Reference in New Issue
Block a user