0.0.6 • Published 4 years ago

chin-plugin-compose v0.0.6

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

chin-plugin-compose

npm npm Build Status Coverage Status

chin plugin compose extensions.

Installation

yarn add -D chin chin-plugin-compose

Usage

compose(extensions)

const compose = require('chin-plugin-compose')
const unified = require('chin-plugin-unified')
const mdast2hast = require('remark-rehype')
const json = require('chin-plugin-json')

const md2html2json = compose([
  unified('m2h', [mdast2hast]),
  json()
])

dock(type, extensions, options)

Because composed extension's type is determined by extensions[0], dock can be used in the situation when need to compose extensions that includes different type.

const { compose, dock } = require('chin-plugin-compose')
const inkscape = require('chin-plugin-inkscape')
const imagemin = require('chin-plugin-imagemin')

const svg2png2min = compose([
  inkscape('png'), // { isStream: true }
  dock('buffer', [ imagemin() ])
])

const svg2min2png = compose([
  imagemin(), // { isStream: false }
  dock('stream', [ inkscape('png') ])
])

type

  • 'stream'
  • 'buffer'

options

  • encoding (= null)

Plugins

nameencodingisStream
chin-plugin-imageminnull-
chin-plugin-unified'utf8'-
chin-plugin-json'utf8'-
chin-plugin-convert-svgnull-
chin-plugin-inkscapenull
chin-plugin-svgrnull-
chin-plugin-faviconsnull-
chin-plugin-gulpnull-

License

MIT (http://opensource.org/licenses/MIT)

0.0.5

4 years ago

0.0.6

4 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago