grunt-cache-manage

Generate a file which manages file's versions.


Keywords
gruntplugin, grunt, grunt-plugins, javascript
License
MIT
Install
npm install grunt-cache-manage@0.3.1

Documentation

grunt-cache-manage

npm version Build Status

Generate a file which manages file's versions.

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-cache-manage --save-dev

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

grunt.loadNpmTasks('grunt-cache-manage');

The "cache_manage" task

Overview

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

grunt.initConfig({
  cache_manage: {
    main: {
      options: {
        algorithm: 'md5',
        encoding: 'utf8'
      },
      files: {
        'samplemainjs': 'sample-main.js'
      },
      template: 'sample-mustache-template.txt',   // mustache template file.
      dest: 'sample-dest.txt'                     // output file.
    }
  }
});

Options

options.algorithm

Type: String Default value: 'md5'

options.encoding

Type: String Default value: 'utf8'

Usage Examples

Default Options

grunt.initConfig({
  cache_manage: {
    options: {},
    files: {
      'key_name': 'path/to/file',
    },
    template: 'path/to/template/file',
    dest: 'path/to/dest/file'
  }
});

Custom Options

grunt.initConfig({
  cache_manage: {
    options: {
      algorithm: 'sha1',
      encoding: 'utf16le',
    },
    files: {
     'key_name': 'path/to/file',
    },
    template: 'path/to/template/file',
    dest: 'path/to/dest/file'
  }
});

Release History

date version description
2019-02-28 v0.3.1 Fix dependencies vulnerabilities ( #6 )
2018-10-11 v0.3.0 Fix dependencies vulnerabilities ( #5 )
2018-04-28 v0.2.0 Updated dependencies. ( #4 )
2018-01-26 v0.1.3 Print error detail when failed hashing. ( #2 )
2014-10-30 v0.1.0 First release.