1
1
mirror of https://github.com/primer/css.git synced 2024-12-18 03:31:43 +03:00
css/docs/lib/frontmatter.js
2018-12-17 15:26:09 -08:00

13 lines
248 B
JavaScript

const matter = require('gray-matter')
module.exports = function frontmatterLoader(src) {
try {
const {content, data} = matter(src)
return `${content}
export const meta = ${JSON.stringify(data)}
`
} catch (error) {
return src
}
}