JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1936
  • Score
    100M100P100Q111104F
  • 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

NPM Dependencies DevDependencies Code Style License MIT

webpack

Loader for PostHTML

Branch Build Coverage
Master travis cover
Develop travis-dev cover-dev
Release v1.0.0 travis-rel-1.0.0 cover-rel-1.0.0

Install

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

Usage

Setup

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

posthtml: () => {
  return {
    defaults: [ /* PostHTML Plugins */ ]
  }
}

Options

// webpack.config.js
module: {
  loaders: [
    {
      test: /\.html$/,
      loader: 'html!posthtml?pack=html'
    }
  ]
},

posthtml: () => {
  return {
    defaults: [],
    html: [ /* PostHTML Plugins */ ],
  }
}

Extract Text

// webpack.config.js
const ExtractText = require('extract-text-webpack-plugin')

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

posthtml: () => {
  return {
    defaults: [ /* PostHTML Plugins */ ]
  }
},

plugins: [
  new ExtractText('[name].html')
]

Integration

Template Loader

{
  test: /\.hbs$/,
  loader: 'html!posthtml!template-html?engine=handlebars'
}

String

HTML

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

SVG

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

File && Val Loader

HTML

{
  test: /\.html$/,
  loader: 'file?name=[name].[ext]!val!html!posthtml'
}

SVG

{
  test: /\.svg$/,
  loader: 'file?name=[name].[ext]!val!svg!posthtml'
}

DOM Loader

HTML

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

SVG

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