GitXplorerGitXplorer
e

combine-loader

public
8 stars
0 forks
19 issues

Commits

List of commits on branch master.
Unverified
2e1ed0af2f84164c692329c8a140690c86a978a9

Update dependency webpack to v5.94.0

rrenovate[bot] committed 25 days ago
Unverified
a7cadca0c4a410e530136ab6f0b592f56c28a63d

Update dependency webpack to v5.93.0

rrenovate[bot] committed 2 months ago
Unverified
d75caa600a1045be42633e12191644372d3402e4

Update dependency prettier to v2.8.8

rrenovate[bot] committed 2 months ago
Unverified
cd3cd6781ce1725af83caeac1a4fd3d312626ace

Update dependency highlight.js to v10.7.3

rrenovate[bot] committed 2 months ago
Unverified
1be7c4dbce63bd818f2b2980fa04d4b83d7d76a4

Update dependency loader-utils to v2.0.4 [SECURITY]

rrenovate[bot] committed 2 months ago
Unverified
0ecd30b1934b92045acbf75df293f0e5ba44812c

Update dependency webpack to v5.76.0 [SECURITY]

rrenovate[bot] committed 2 months ago

README

The README file for this repository.

combine-loader

npm version Appveyor Build status

webpack loader to combine results from multiple loaders into one object

Installation

npm install combine-loader

Usage

In your webpack configuration, pass an object as the options for combine-loader. Each key-value pair corresponds to the same key in the exported object, using the provided loader string value to load the file. For example:

module.exports = {
  // ...
  module: {
    // ...
    rules: [
      {
        test: /\.md$/,
        loader: 'combine-loader',
        options: {
          raw: 'raw-loader',
          frontmatter: [
            'json-loader',
            'front-matter-loader?{"onlyAttributes":true}',
          ],
          content: [
            'html-loader',
            'markdown-it-loader',
            'front-matter-loader?{"onlyBody":true}',
          ],
        },
      },
    ],
  },
};

In the above example, the final exported value for .md files is an object with keys raw, frontmatter, and content, with values loaded using the provided loaders. In other words, this...

const example = require('./example.md');

...is effectively equivalent to this:

const example = {
  raw: require('!raw-loader!./example.md'),
  frontmatter: require('!json-loader!front-matter-loader?{"onlyAttributes":true}!./example.md'),
  content: require('!html-loader!markdown-it-loader!front-matter-loader?{"onlyBody":true}!./example.md'),
};

NOTE: ! is prepended to override loaders in webpack's config