Appends hashes to bundles built by require.js optimizer.

npm install rjs-build-hasher
26 downloads in the last week
55 downloads in the last month

rjs-build-hasher Build Status

Calculates hashes of bundles generated by require.js. Supports renaming bundle files by given format, plus a few other options. Uses the peg parser used in rjs-build-analysis by Merrick Christensen.


npm install --save-dev rjs-build-hasher


Default options

  • buildPath: js/build
  • format: {base}.{hash}{ext} - Format used for new name when renaming (or copying) built files.
  • rename: true
  • copy: false (overrides rename if true)
  • removeOld: true
  • hashSize: 8


Example: used with grunt-contrib-requirejs

    requirejs: {
        compile: {
            options: {        
                done: function (done, output) {

                    var bundles = require('rjs-build-hasher')(output, {
                        buildPath: 'public/js'

                    // save info about built files to configuration
            grunt.file.write('config/built-modules.json', JSON.stringify(bundles, null, 2));


Accepting pull requests. Will appreciate it if you add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

See commit history.


Copyright (c) 2013 Dag Einar Monsen. Licensed under the MIT license.

npm loves you