https://github.com/alexeyraspopov/gulp-wrap-exports
Wrap CommonJS module in IIFE and create global variable for browser
https://github.com/alexeyraspopov/gulp-wrap-exports
Last synced: about 1 month ago
JSON representation
Wrap CommonJS module in IIFE and create global variable for browser
- Host: GitHub
- URL: https://github.com/alexeyraspopov/gulp-wrap-exports
- Owner: alexeyraspopov
- Created: 2014-03-15T16:12:59.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-09T19:07:09.000Z (almost 11 years ago)
- Last Synced: 2025-03-18T03:12:30.881Z (about 2 months ago)
- Language: JavaScript
- Size: 180 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# [gulp](https://github.com/wearefractal/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](http://en.wikipedia.org/wiki/MIT_License) (c) Alexey Raspopov