W3cubDocs

/webpack

yaml-frontmatter-loader

YAML Frontmatter loader for webpack. Converts YAML in files to JSON. You should chain it with json-loader.

Install

npm install yaml-frontmatter-loader

Usage

var json = require("json-loader!yaml-frontmatter-loader!./file.md");
// => returns file.md as javascript object

Configuration

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
         test: /\.md$/,
         use: [ 'json-loader', 'yaml-frontmatter-loader' ]
      }
    ]
  }
}

© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/loaders/yaml-frontmatter-loader