New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-rev-json

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-rev-json

Grunt task to digest files and output rev for each file in a json.

0.2.0
latest
Source
npm
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

grunt-rev-json NPM version Dependencies

Digest files and output rev for each file in a json.

Getting Started

npm install grunt-rev-json --save

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

grunt.loadNpmTasks('grunt-rev-json');

The "rev_json" task

Overview

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

grunt.initConfig({
  rev_json: {
    options: {
      // algorithm used to digest
      // crc32c and all crypto.createHash supported algorithms
      algorithm: 'crc32c'
      // encoding of digest
      // base64, hex
      encoding: 'base64',
      // use url safe base64, only works when encoding is base64
      urlSafe: true,
      // prefix length of encoded digest, pass 0 or -1 to use complete digest
      length: 8
    },
    your_target: {
      src: ['public/**/*.{js,css}']
      dest: 'rev.json'
    },
  },
});

Example

$ pwd
/Users/xiaoyi/Projects/public
$ tree
.
├── scripts
│   ├── desktop.js
│   ├── error.js
│   └── moment.js
└── styles
    ├── desktop.css
    └── mobile.css
grunt.initConfig({
  rev_json: {
    options: {
      algorithm: 'sha224',
      length: -1
    },
    static: {
      src: ['public/**/*.{js,css}'],
      dest: 'public/rev.json'
    }
  }
});
{
  "scripts/desktop.js": "eSgRA3v4XUcOM66neA7Y2ZfMOX5w0hNWVfuHpQ",
  "scripts/error.js": "ZQIiKlJ0_Nj0F8-hi1mnYccZ61rJ5n426vgVBw",
  "scripts/mobile.js": "QxB9zfm1PyhYKFMBiqXh9ox8fmCcNmwXWkTRFg",
  "styles/desktop.css": "xjrIkYLwmiL6tTMduEjtziR3cr3bJkxyHZ3wQw",
  "styles/mobile.css": "YcJ2rs1SI7kbcjgnVO8K0Bf1moFVLwmbPHrVaw"
}

Output JSON will use src path (relative to output file location) as key, and digest as value.

Keywords

gruntplugin

FAQs

Package last updated on 30 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts