JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1795
  • Score
    100M100P100Q109613F
  • License MIT

PostHTML loader for Webpack

Package Exports

  • posthtml-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (posthtml-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

PostHTML Loader

Webpack loader for PostHTML

Install

(sudo) npm i -D webpack
(sudo) npm i -D posthtml-loader

Usage

Setup

// webpack.config.js

module: {
  loaders: [
    {
      test: /\.html$/,
      loader: 'html!posthtml'
    },
  ]
},

posthtml: function () {
  return {
    defaults: [ PostHTML Plugins ]
    // Add our own Plugin Packs
  }
}

Options

module.exports = {
  module: {
    loaders: [
      {
        test: /\.html$/,
        loader: 'html!posthtml'
      }
      {
        test: /\.include\.html$/,
        loader: 'html!posthtml?pack=includes'
      }
    ]
  },

  posthtml: function () {
    return {
      defaults: [ PostHTML Plugins ],
      includes: [ PostHTML Plugins ]
    }
  }
}

Examples

with jade-html-loader

{ test: /\.jade$/, loader: 'html!posthtml!jade-html' }

with handlebars-loader

{ test: /\.hbs$/, loader: 'handlebars!html!posthtml' }

with dom-loader

{ test: /\.html$/, loader: 'dom!html!posthtml' }

with svg-loader

{ test: /\.svg$/, loader: 'svg!posthtml' }

with extract-text-plugin

var ExtractText = require('extract-text-webpack-plugin')

module.exports = {
  module: {
    loaders: [
      {
        test: /\.html$/,
        loader: ExtractText.extract('html!posthtml')
      }
    ]
  },

  posthtml: function () {
    return {
      defaults: [ PostHTML Plugins ]
    }
  },

  plugins: [
    new ExtractText('output.html')
  ]
}