0.2.4 • Published 6 years ago

ware-loader v0.2.4

Weekly downloads
713
License
MIT
Repository
github
Last release
6 years ago

npm deps

npm install --save-dev ware-loader

Use the loader either via your webpack config. Here is an example to parse markdown file as vue component.

Via webpack config (recommended)

webpack.config.js

const MarkdownIt = require('markdonw-it')
const md = new MarkdownIt()

module.exports = {
  module: {
    rules: [
      {
        test: /\.md$/,
        loader: 'ware-loader',
        enforce: 'pre',
        options: {
          raw: true,
          middleware: function(source) {
            return `<template><div>${md.render(source)}</div></template>`
          }
        }
      },
      {
        test: /\.md$/,
        use: 'vue-loader'
      }
    ]
  }
}

In your application

import Doc from './doc.md';
OptionDescriptionTypeDefault
rawIf set to false, source will be wrapped with 'module.exports = ' + sourcebooleanfalse
asyncWhehter middleware should be async functionbooleanfalse
middlewareFunctions to change sourcefunction[], function-
0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago