unified-engine-gulp

unified engine to create a Gulp plugin from a processor

Usage no npm install needed!

<script type="module">
  import unifiedEngineGulp from 'https://cdn.skypack.dev/unified-engine-gulp';
</script>

README

unified-engine-gulp

Build Coverage Downloads Sponsors Backers Chat

unified engine to create a Gulp plugin from a processor. Wrapper around unifiedjs/unified-engine.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install unified-engine-gulp

Use

import {engineGulp} from 'unified-engine-gulp'
import {remark} from 'remark'

export const gulpRemark = engineGulp({
  name: 'gulp-remark',
  processor: remark,
  rcName: '.remarkrc',
  packageField: 'remarkConfig',
  ignoreName: '.remarkignore',
  pluginPrefix: 'remark'
})

API

This package exports the following identifiers: engineGulp. There is no default export.

engineGulp(options)

Create a Gulp plugin from a processor. Read more about writing a Gulp plugin ».

options

Anything not set in options, but in the below list, can be set later by users of the plugin.

options.name (string, required)

Name of Gulp plugin (used in errors).

options.processor

Unified processor to transform files (Processor, required).

options.streamError

Stream to write the report (if any) to (WritableStream, default: process.stderr).

options.tree

Whether to treat both input and output as a syntax tree (boolean, default: false).

options.treeIn

Whether to treat input as a syntax tree (boolean, default: tree).

options.treeOut

Whether to treat output as a syntax tree (boolean, default: tree).

options.inspect

Skip the compilation phase and output a syntax tree formatted with unist-util-inspect (boolean, default: false).

options.rcName

Name of configuration files to load (string, optional).

options.packageField

Property at which configuration can be found in package.json files (string, optional).

options.detectConfig

Whether to search for configuration files (boolean, default: whether rcName or packageField is given).

options.rcPath

File-path to a configuration file to load (string, optional).

options.settings

Configuration for the parser and compiler of the processor (Object, optional).

options.ignoreName

Name of ignore files to load (string, optional).

options.detectIgnore

Whether to search for ignore files (boolean, default: whether ignoreName is given).

options.ignorePath

File-path to an ignore file to load (string, optional).

options.ignorePathResolveFrom

Whether to resolve patterns in ignorePath relative to its directory or the current working directory ('dir' or 'cwd', default: 'dir').

options.ignorePatterns

Extra patterns to ignore in combination with ignorePath or found ignores (Array.<string>, optional).

options.plugins

Map of plug-in names or paths and options to use (Object, optional).

options.pluginPrefix

When given, optional prefix to use when searching for plug-ins (string, optional).

options.defaultConfig

Optional object with plugins and/or settings to use if no config file is supplied by the user (Object, optional).

options.configTransform

Transform config files from a different schema (Function, optional).

options.reporter

Reporter to use (string or function, default: require('vfile-reporter')).

options.reporterOptions

Config to pass to the used reporter (Object?, optional).

options.color

Whether to report with ANSI color sequences (boolean, default: false).

options.silent

Report only fatal errors (boolean, default: false).

options.quiet

Do not report successful files (boolean, default: silent).

options.frail

Treat warnings as errors (boolean, default: false).

Returns

A standard through2 object stream, accepting Vinyl files (fileStream). Streaming vinyl files are not supported. Read more about why in Gulp’s docs (point 10).

There’s also a fileStream.use() function, which mimics unified.use() in that it accepts a plugin and configuration. It returns the operated on fileStream.

Contribute

See contributing.md in unifiedjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer