Socket
Book a DemoInstallSign in
Socket

grunt-global-wrap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-global-wrap

Grunt task to expose your CommonJS-based libraries as a global.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Global-ify Your CommonJS, via Grunt

This is a Grunt plugin to expose your CommonJS libraries as globals on window. It allows you to produce build artifiacts that are readily usable by people who haven't embraced the magnificence of browserify. You point it at your main module, and it exposes that as a specified property of the global, bundling up everything it requires (including any native module shims) into the output file.

It's based on global-wrap, if you want this functionality outside of a Grunt plugin.

Usage

It takes four options, three of which are required:

  • main: the file path of your main module, which you want to expose as a global.
  • global: the name of the global you want to expose.
  • dest: the place where your new global-exposing file should be written.
  • bundleOptions: any browserify bundle options you want to pass along, like debug or detectGlobals. This is the optional option.

Here's a quick sample:

grunt.loadNpmTasks("grunt-global-wrap");

grunt.initConfig({
    globalwrap: {
        releaseArtifactsTarget: {
            main: "my-main-module.js",
            global: "myModule",
            dest: "release/my-module.global.js",
            bundleOptions: { debug: true }
        }
    }
});

Keywords

browserify

FAQs

Package last updated on 16 Aug 2013

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