1.1.1 • Published 10 years ago

gulp-content-plugin v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
10 years ago

gulp-content-plugin

A blueprint for a gulp plugin that transforms the content of a given file.

Default usage: Fork gulp-content-plugin, change the plugin.js and make the result accessible to your gulpfile (let's say as gulp-my-content-plugin). Then use it just like any other gulp plugin:

var gulp = require("gulp");

var myContentPlugin = require("gulp-my-content-plugin");

gulp.src("myfile.txt")
.pipe(myContentPlugin())
.pipe(gulp.dest("."));

If you don't want to fork the whole repository for every content-transforming plugin you want to use, just use the .fork() method on the content plugin like this:

var gulp = require("gulp");

var contentPlugin = require("gulp-content-plugin");

var upperCase = contentPlugin.fork({
    defaultOptions: {
        encoding: "utf-8" // this option is mandatory in every fork
    },
    transform: function(content, options, file) {
        return content.toUpperCase();
    }
});

gulp.src("myfile.txt") // input: hello world!
.pipe(upperCase())
.pipe(gulp.dest(".")); // output: HELLO WORLD!

All necessary informations are included as comments in the plugin.js.

1.1.1

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago