You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

gulp-browserify-thin

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons

gulp-browserify-thin

A very thin extension of Browserify that causes the .bundle() method to return a vinyl file instead of a stream.

0.1.4
unpublished
npmnpm
Version published
Weekly downloads
4
100%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-browserify-thin

A very thin extension of Browserify that overrides the bundle() method to return a vinyl file object stream instead of a original node readable stream.

Until you call bundle(), you are working with a plain old browserify instance. See Browserify's documentation for option and method documentation.

Installation

$ npm install gulp-browserify-thin --save-dev

Usage

In your gulpfile...

var gulp = require('gulp');
var browserify = require('gulp-browserify-thin');

gulp.task('default', function()
{
	// This part is just like using vanilla Browserify.
	var b = browserify(/* files=[] or opts={} */)
		.add(file, opts)
		.require(file, opts)
		.external(file)
		.ignore(file)
		.exclude(file)
		.transform(opts, tr)
		.plugin(plugin, opts)
		// ... and so on, calling browserify methods any way you want.
		;

	// The bundle method is the only one that's different from vanilla
	// Browserify. It takes a filename instead of an optional callback.
	// The filename does not need to exist. It's "fake" so that downstream gulp
	// plugins that expect a filename will still work. It will also be your
	// output filename if you pipe to gulp.dest().
	var stream = b.bundle('output.file.name.js')

	// You now have a through object stream that will have a vinyl file
	// pushed into it. The vinyl file contains the filename and the readable
	// stream that Browserify outputs. This is what gulp plugins are
	// expected to return so you can now do your gulp thing!

	stream
		// errors emitted by the original Browserify bundle method are
		// re-emitted on the through stream so that they can be handled in your
		// gulp file.
		.on('error', function(err)
		{
			console.error(err.toString());

			// If you want to abort the gulp run then you'll need to exit.
			process.exit(1);
		})
		.pipe(/* some other gulp plugin that handles streamed sources */)
		.pipe(gulp.dest('./out'));

	// Remember to return the stream when you're done so that any dependant
	// tasks know not to start until this task is done.
	return stream;
});

Keywords

gulp

FAQs

Package last updated on 19 Aug 2014

Did you know?

Socket

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.

Install

Related posts