Skip to content

v2.0.0

Compare
Choose a tag to compare
@michael-ciniawsky michael-ciniawsky released this 15 Nov 11:34
· 59 commits to master since this release

Chore

  • Update dotfiles

Docs

  • Update README.md
  • Update INDEX.md (JSDoc)

Tests

  • Add tests

Features

Its is now possible to use one of posthtml's cutom parsers posthtml-pug / posthtml-sugarml with gulp-posthtml.

Secondly gulp-posthtml now supports the 'common' config approach via a config file (posthtml.config.js) and will autoload it when present. Config loading is relative to the current file (directory) processed by gulp-posthtml. It continues searching for configs upwards until the project root is reached. For advanced usage placing different config files downwards is possible and the nearest config file found will be loaded and used by gulp-posthtml.

gulp-posthtml also adds the follow props to the config context ctx

ctx.env === process.env.NODE_ENV // Default === 'development' 
ctx.dir === dirname(file.path)   // File Directory
ctx.ext === extname(file.path)   // File Extension

posthtml.config.js

module.exports = (ctx) => {
  return {
    parser: ctx.ext === '.sml'  ? 'posthtml-sugarml' : false 
    plugins: {
      'posthtml-include': { root: ctx.dir },
      'htmlnano': ctx.env === 'production' ? {} : false 
    }
  }
}

For more information about posthtml.config.js, see posthtml-load-config