feat(yaml): use !match tag to process content

This commit is contained in:
Haoyu Xu
2023-01-21 17:20:17 -05:00
parent 899f424d5d
commit f363c0b908
4 changed files with 56 additions and 81 deletions

View File

@@ -2,7 +2,7 @@ import path from 'path'
import { parse } from 'yaml'
import fs from 'fs'
export function read(file_dir) {
export function read(file_dir, customTags = []) {
const include = {
identify: value => value.startsWith('!include'),
tag: '!include',
@@ -14,6 +14,6 @@ export function read(file_dir) {
}
const file = fs.readFileSync(file_dir, 'utf8')
return parse(file, {
customTags: [include],
customTags: [include, ...customTags],
})
}