Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
gulp-plugin-fabric
Advanced tools
Create gulp plugin from a function or object that works with string data (e.g. a converter).
Exposes function that returns a gulp plugin: gulpPluginFabric(name, run, [init])
.
name
: name of the plugin (will be gulp-name
)run
: function that transforms incoming data, can be both sync or asyncinit
: function that is launched before run
with options (optional)The following types of functions are supported:
run(data, options)
returns resulting string, or throws an errorrun(data, options, cb)
calls cb(null, result)
upon successful completion, or cb(err)
in case of an errorLet's create a simple gulp plugin that adds a custom suffix to the input string. For example, suffix "!" would result in "str" -> "str!" transformation.
Convert function to gulp plugin:
let run = (text, options) => text + options.suffix;
let plugin = require('gulp-plugin-fabric')("my-plugin", run);
Convert object to gulp plugin:
let runner = {
_suffix: "!",
run: function(text, options) {
return text + this._suffix;
},
init: function (options) {
this._suffix = options.suffix | "";
}
};
let plugin = require('gulp-plugin-fabric')("my-plugin", runner.run.bind(runner), runner.init.bind(runner));
Then you can use plugin in gulp as follows:
gulp.src('.')
.pipe(plugin({suffix: "!"}))
.pipe(gulp.dest('out'));
FAQs
Generate gulp plugin from a class or function
The npm package gulp-plugin-fabric receives a total of 10 weekly downloads. As such, gulp-plugin-fabric popularity was classified as not popular.
We found that gulp-plugin-fabric demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.