Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

combine-loader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combine-loader

webpack loader to combine results from multiple loaders into one object

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 28 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc