0.2.1 • Published 6 years ago

grunt-package-minifier v0.2.1

Weekly downloads
4
License
-
Repository
github
Last release
6 years ago

grunt-package-minifier

Minimizes space taken by node modules and their dependencies.

NodeJS packages are generally deployed with a full hierarchy of supporting files include package.json, README and tests. For cases where the packages are to be bundled with an application and distributed, the extra space taken by these support files can signficantly increase the size of the distributed bundle.

This plugin takes the one of more package.json files as input and flattens each package so that only the necessary JavaScript files are copied to the output directory. It uses node-required to trace the dependencies.

This plugin is similar to browserify but it preserves the CommonJS-compatible modile structure rather than concatenating everything into one big file.

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-package-minifier --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-package-minifier');

The "package_minifier" task

Overview

In your project's Gruntfile, add a section named package_minifier to the data object passed into grunt.initConfig().

grunt.initConfig({
  package_minifier: {
    your_target: {
      target: '', // (optional) Entry point (e.g 'browser') to use, when present, instead of 'main' (the default)
      src: [], // Path to package.json files for modules to be minified
      dest: '' // Target directory for minified modules.
    },
  },
})

TODO LIST

  • Rewrite tests
0.2.1

6 years ago

0.2.0

6 years ago