YAML Frontmatter loader for webpack. Converts YAML in files to JSON. You should chain it with json-loader.
npm install yaml-frontmatter-loader
var json = require("json-loader!yaml-frontmatter-loader!./file.md");
// => 将 file.md 作为一个 javascript 对象返回
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.md$/,
use: [ 'json-loader', 'yaml-frontmatter-loader' ]
}
]
}
}