Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Wraps .js files into CommonJS modules for client-side usage.
JavaScript
branch: master

Merge pull request #2 from spadgos/patch-1

Removes newline from wrapper to avoid off-by-one stack traces
latest commit b3d5c34a5a
Vijay Karunamurthy authored

README.md

grunt-commonjs

Wraps .js files into CommonJS modules for client-side usage.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-commonjs --save-dev

Then add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-commonjs');

CommonJS loader

You'll need a loader to detect your wrapped packages. You can use this simple CommonJS loader which is based off how brunch.io loads CommonJS packages.

Documentation

Configure which files to be copied in your initConfig:

grunt.initConfig({

  // ... other configs

  // wrap my modules with define
  commonjs: {
    modules: {
      cwd: 'assets/',
      src: ['**/*.js'],
      dest: 'dist/'
    }
  },

  // ... other configs
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

  • 2013 Feb 04 - v0.2.0rc7 - Refactor to use grunt 0.4.x's file properties.
  • 2013 Jan 29 - v0.1.0rc7 - Initial release.

License

Copyright (c) 2012 Team Delicious, AVOS Systems Inc. Licensed under the MIT license.

Something went wrong with that request. Please try again.