gc

grunt-commonjs

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

Showing:

Popularity

Downloads/wk

27

GitHub Stars

9

Maintenance

Last Commit

8yrs ago

Contributors

3

Package

Dependencies

1

Size (min+gzip)

0.3KB

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100