Skip to content
No description, website, or topics provided.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes
.jshintrc
.npmignore
index.js
package.json
readme.md

readme.md

gulp-wrap-exports

Wrap CommonJS module in IIFE and create global variable

Install

npm install --save-dev gulp-wrap-exports

Example

var gulp = require('gulp'),
	wrap = require('gulp-wrap-exports');

gulp.task('default', function(){
	return gulp.src('fn-module.js')
		.pipe(wrap({ name: 'fn' }))
		.pipe(gulp.dest('dest/'));
});

Example input:

exports.processing = function(){};

Example output (name: 'module'):

!function(exports, global){
	global.module = exports;
	
	exports.processing = function(){};
	
}({}, function(){ return this; }());

Options

String name - valid name of global variable which should be available in browser.

License

MIT License (c) Alexey Raspopov

You can’t perform that action at this time.