{"id":45056,"library":"grunt-hash","title":"grunt-hash","description":"grunt-hash is a Grunt plugin that appends a unique hash (MD5 or custom) to filenames for cache busting. It generates mapping files for server-side asset lookup. Stable version 0.5.0, last released in 2013. Requires Grunt 0.4.x. Differentiators: simple configuration, supports custom hash functions, and outputs mapping JSON. No longer actively maintained; consider alternatives like gulp-rev or webpack.","status":"abandoned","version":"0.5.0","language":"javascript","source_language":"en","source_url":"git://github.com/jgallen23/grunt-hash","tags":["javascript","gruntplugin"],"install":[{"cmd":"npm install grunt-hash","lang":"bash","label":"npm"},{"cmd":"yarn add grunt-hash","lang":"bash","label":"yarn"},{"cmd":"pnpm add grunt-hash","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for Grunt tasks","package":"grunt","optional":false}],"imports":[{"note":"Grunt tasks are loaded via loadNpmTasks, not direct require.","wrong":"require('grunt-hash');","symbol":"grunt-hash task","correct":"grunt.loadNpmTasks('grunt-hash');"},{"note":"Missing target (e.g., js, css) configuration block.","wrong":"grunt.initConfig({ hash: { src: '...', dest: '...' } });","symbol":"hash config","correct":"grunt.initConfig({ hash: { options: {}, js: { src: '...', dest: '...' } } });"},{"note":"Must be a function, not a string.","wrong":"hashFunction: 'sha1'","symbol":"hashFunction option","correct":"hashFunction: function(source, encoding) { return require('crypto').createHash('sha1').update(source, encoding).digest('hex'); }"}],"quickstart":{"code":"module.exports = function(grunt) {\n  grunt.initConfig({\n    hash: {\n      options: {\n        mapping: 'dist/assets.json',\n        srcBasePath: 'src/',\n        destBasePath: 'dist/',\n        flatten: false,\n        hashLength: 8,\n        hashFunction: function(source, encoding) {\n          return require('crypto').createHash('md5').update(source, encoding).digest('hex');\n        }\n      },\n      js: {\n        src: 'src/**/*.js',\n        dest: 'dist/js/'\n      },\n      css: {\n        src: 'src/**/*.css',\n        dest: 'dist/css/'\n      }\n    }\n  });\n  grunt.loadNpmTasks('grunt-hash');\n  grunt.registerTask('default', ['hash']);\n};","lang":"javascript","description":"Gruntfile configuration for grunt-hash with custom hash function, mapping output, and JS/CSS targets."},"warnings":[{"fix":"Migrate to gulp-rev or webpack chunk hashing.","message":"Package is unmaintained since 2013. Use at your own risk. Consider gulp-rev or webpack for cache busting.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Use grunt-cli with Grunt 0.4.x or wrap task.","message":"Requires Grunt 0.4.x. Not compatible with Grunt 1.x without compatibility layer.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Ensure dest directories exist before running grunt-hash.","message":"If dest folder does not exist, the task may fail silently or not create output.","severity":"gotcha","affected_versions":"*"},{"fix":"Backup mapping file if needed.","message":"Mapping file is overwritten on each run; no incremental merge.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'0.4':43 '0.5.0':36 '2013':40 'activ':58 'altern':61 'append':12 'asset':32 'bust':23 'cach':22 'configur':47 'consid':60 'custom':18,49 'differenti':45 'file':27 'filenam':20 'function':51 'generat':25 'grunt':2,5,9,42 'grunt-hash':1,4 'gruntplugin':69 'gulp':64 'gulp-rev':63 'hash':3,6,15,50 'javascript':68 'json':55 'last':37 'like':62 'longer':57 'lookup':33 'maintain':59 'map':26,54 'md5':16 'output':53 'plugin':10 'releas':38 'requir':41 'rev':65 'server':30 'server-sid':29 'side':31 'simpl':46 'stabl':34 'support':48 'uniqu':14 'version':35 'webpack':67 'x':44","created_at":"2026-06-07T12:53:09.716528+00:00","updated_at":"2026-06-07T12:53:09.716528+00:00","problems":[{"fix":"Add grunt.loadNpmTasks('grunt-hash'); after initConfig.","cause":"Gruntfile missing grunt.loadNpmTasks('grunt-hash') line.","error":"Warning: Task \"hash\" not found. Use --force to continue."},{"fix":"Run npm install grunt-hash --save-dev","cause":"Package not installed locally.","error":"Fatal error: Unable to find Grunt plugin \"grunt-hash\""},{"fix":"Set hashFunction to a function returning hash string.","cause":"hashFunction option set to a string instead of a function.","error":"TypeError: hashFunction is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jgallen23/grunt-hash","github":"git://github.com/jgallen23/grunt-hash","docs":null,"changelog":null,"pypi":null,"npm":"grunt-hash","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}