Next Phenomenal Microbrewery

    gulp-exports

    0.0.3 • Public • Published

    gulp-exports

    Expose module.exports to a global object, like window in the browser envrionment.

    install

    npm install --save-dev gulp-exports
    

    usage

    number.js

    module.exports = 1;
    

    build

    var gulp = require('gulp');
    var wrap = require('gulp-exports');
    gulp.src('number.js')
        .pipe(wrap('window', 'One'))
        .pipe(gulp.dest('dist'));

    dist/number.js

    (function (module, exports) {
       var _exports = module.exports;
       module.exports = module["One"] || {};
       exports = module["One"] = module.exports;
       /****** code begin *********/
    module.exports = 1;
     
       /****** code end *********/
       if (typeof _exports === "undefined") {
           delete module.exports;
       } else if ("One" !== "exports") {
           module.exports = _exports;
       }
    }).call(window, window, window["One"]);
     

    Now in browser:

    window.One === 1; // true
    

    Install

    npm i gulp-exports

    DownloadsWeekly Downloads

    4

    Version

    0.0.3

    License

    MIT

    Last publish

    Collaborators

    • zoubin