Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including grunt-jsmin-sourcemap with all npm packages installed. Try it out:

var gruntJsminSourcemap = require("grunt-jsmin-sourcemap")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

grunt-jsmin-sourcemap v1.10.0

Grunt task for JSMin and sourcemap

grunt-jsmin-sourcemap Build status

Grunt task for JSMin and source maps.


Grunt is a node.js based CLI build tool.

JSMin is a JavaScript minifier that removes whitespace and comments.

Source maps enables developers to view and interact with minified JavaScript as if it were unminified (providing useful line errors and easier debugging).

When you combine all three of these, you get a grunt plugin that is your new best debugging friend.


The demos in the node-jsmin-sourcemap, what makes this tick, are hosted on Plunker for your testing and enjoyment.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-jsmin-sourcemap

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



grunt-jsmin-sourcemap is registered under the jsmin-sourcemap task. Your initConfig should look similar to this:

  'jsmin-sourcemap': {
    all: {
      // Source files to concatenate and minify (also accepts a string and minimatch items)
      src: ['public/js/jquery.js', 'public/js/underscore.js'],

      // Destination for concatenated/minified JavaScript
      dest: 'dist/js/all.min.js',

      // Destination for sourcemap of minified JavaScript
      destMap: 'dist/js/'

      // Optional root for all relative URLs
      srcRoot: 'some/lower/directory'

      // Optional cwd to resolve from for all URLs
      // Converts jquery.js -> some/higher/directory/jquery.js during lookup but mapping preserves jquery.js in map file
      cwd: 'some/higher/directory'

    // Compact format is also accepted
    'dest/file.js': ['src/file1.js', 'src/file2.js']


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


Support this project and others by twolfson via gittip.

Support via Gittip


As of Dec 05 2013, Todd Wolfson has released this repository and its contents to the public domain.

It has been released under the UNLICENSE.

Previous to this, it was licensed under the MIT license.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free