1.0.4 • Published 7 years ago

fusebox-gulp-plugin v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

fusebox-gulp-plugin

Adapt gulp plugins to work with fuse-box.

Usage

const fsbx = require('fuse-box');
const g = require('gulp-load-plugins')();
const { GulpPlugin } = require('fusebox-gulp-plugin');

const fuseBox = fsbx.FuseBox.init({
    homeDir: 'src/',
    outFile: './build/app.js',
    plugins: [
        // Other fusebox plugins...
        GulpPlugin([
        	(file) => g.replace('foo', 'bar'),
        	// Other gulp plugins...
        ])
    ]
});

Note: GulpPlugin is applicable to all files, so you must control type of transform by ChainPlugin (see examples below).

Also, you can use only those plugins which only manipulates contents property of vinyl file.
Applying of some plugins, like gulp-rename, does not make sense, because they do not affect contents, but others - path, dirname, etc.

API

function GulpPlugin(streamFactories: ((file: File) => stream.Transform)[])

Examples

const { GulpPlugin } = require('fusebox-gulp-plugin');
const g = require('gulp-load-plugins')();

Markdown

const plugins = [
    [
        /\.md$/,
        GulpPlugin([
            () => g.markdown(),
        ]),
        RawPlugin({ extensions: ['.md'] }),
    ]
];
var doc = require('./doc.md')

JSON5

const plugins = [
    {
        init: (k) => k.allowExtension('.json5')
    },
    [
        /\.json5$/,
        GulpPlugin([
            () => g.json5(),
        ]),
        JSONPlugin({}),
    ]
];
const data = require('./data.json5');

DEBUG

inspect node_modules/ava/profile.js lib/index.spec.js
1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago