Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

mach6/grunt-node-minify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8d54d39 · Oct 31, 2018

History

44 Commits
Oct 31, 2018
Oct 31, 2018
Dec 11, 2016
Dec 11, 2016
Dec 11, 2016
Dec 11, 2016
Jul 24, 2017
Oct 31, 2018
Aug 28, 2018
Aug 28, 2018
Dec 11, 2016
Oct 31, 2018
Oct 31, 2018
Oct 31, 2018

Repository files navigation

NPM Version Build Status Codacy Badge

Dependency Status devDependency Status

grunt-node-minify

Grunt plugin for node-minify

Getting Started

This plugin requires Grunt >=1.0.0

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-node-minify --save-dev

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

grunt.loadNpmTasks('grunt-node-minify');

The "grunt-node-minify" task

Overview

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

grunt.initConfig({
  'node-minify': {
    your_task: {
      compressor: '',     // Optional, defaults to `gcc`
      sync: '',           // Optional, defaults to `false`
      buffer: '',         // Optional, defaults to `(1024 * 1000)`
      publicFolder: '',   // Optional, defaults to `undefined`
      options: {
        // Optional, compressor specific options go here. See node-minify.
      },
      your_target: {
        // Target-specific file lists and/or options go here.
      }
    }
  }
});

Options

See node-minify for compressors and compressor options {...} which can be specified.

Usage Examples

Default Options

In this example, the default options are used to minify javascript files recursively found in src/ to the file dest/gcc.min.js, using google-closure-compiler-js.

grunt.initConfig({
  'node-minify': {
    gcc: {
      files: {
        'dest/gcc.min.js': ['src/**/*.js']
      }
    }
  }
});

Custom Options

In this example, custom options are used to minify javascript files recursively found in the publicFolder (src) to the file dest/uglifyjs.min.js, using uglifyjs with options { .. }.

grunt.initConfig({
  'node-minify': {
    uglifyjs: {
      compressor: 'uglifyjs',
      publicFolder: 'src/',
      options: {
        warnings: true,
        mangle: false,
        compress: false
      }
      files: {
        'dest/uglifyjs.min.js':  ['**/*.js']
      }
    }
  }
});

Contributing

In lieu of a formal style guide, 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

  • 1.5.0 : Updates dependencies (google-closure-compiler-js).
  • 1.4.0 : Updates dependencies (node-minify, google-closure-compiler-js, and others).
  • 1.3.6 : Updates dependencies (google-closure-compiler-js).
  • 1.3.5 : Updates dependencies (google-closure-compiler-js).
  • 1.3.4 : Updates dependencies (google-closure-compiler-js).
  • 1.3.3 : Updates dependencies (google-closure-compiler-js).
  • 1.3.2 : Updates dependencies (node-minify).
  • 1.3.1 : Updates dependencies (chalk).
  • 1.3.0 : Updates dependencies (node-minify, chalk).
  • 1.2.4 : Updates dependencies (google-closure-compiler-js, node-minify).
  • 1.2.3 : Updates dependencies (google-closure-compiler-js).
  • 1.2.2 : Updates dependencies (google-closure-compiler-js, chalk).
  • 1.2.1 : Updates dependencies.
  • 1.2.0 : Remove bluebird dependency. Fix bugs.
  • 1.1.7 : Updates dependencies (node-minify).
  • 1.1.6 : Updates dependencies.
  • 1.1.5 : Updates dependencies.
  • 1.1.4 : Updates dependencies.
  • 1.1.3 : Updates dependencies.
  • 1.1.2 : Updates dependencies.
  • 1.1.1 : Updates dependencies.
  • 1.1.0 : Adds color to console output.
  • 1.0.1 : Initial release.

License

MIT