Renames static files with a hashcode for cache busting
npm install grunt-hashlygrunt-hashly 
======
grunt-hashly is a grunt binding for hashly, which is a build-time tool that enables cache-busting for static files (images, JavaScript, CSS, etc).
^0.4.0If 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:
``shell`
npm install grunt-hashly --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-hashly');
command._Task targets, files and options may be specified according to the grunt Configuring tasks guide.
$3
This task offers all the same options as the hashly command line interface, so please refer to the documentation for advanced configuration.
#### basePath
Type:
String (required)Sets the base path to use (from which all paths will be root-relative) when generating the hashly manifest file.
#### targetPath
Type:
String
Default: basePathOptionally specify a target directory to which hashed files and the manifest should be copied. If not specified, files are hashed in-place.
#### manifestFormat
Type:
String
Default: jsonOptionally specify the format of the manifest file. Currently supports "json", "json-object" (json with original path as key) or "tab" (tab delimited). Default is "json".
#### manifestPath
Type:
String
Default: jsonSpecifies a path for the manifest file. If not specified, the manifest is named "manifest.{ext}" and is placed in the destination directory root.
#### processCss
Type:
Boolean
Default: falseIf true, image paths in CSS files are rewritten to point to the hashed versions of the images. This ensures that when images change,
the url of the CSS that references them also changes.
#### include
Type:
StringOptionally specify a comma-delimited list of globbing patterns to use to include files to be hashed/copied.
#### exclude
Type:
StringOptionally specify a comma-delimited list of globbing patterns to use to exclude files from being hashed/copied.
#### passthrough
Type
Boolean
Default falseA globbing expression. Any matching files will be copied as-is to the destination folder. Has no effect if the destination is the same as the source.
#### amend
Type
Boolean
Default FalseInstructs hashly to amend an existing manifest, where it would normally delete and recreate it from scratch. This is useful for incrementally adding to a large filesystem.
#### quickhash
Type
Boolean
Default FalseUse the file size for binary files instead of the file contents. This makes processing large binary files extremely quick, though at a (extremely slight) risk that a hashcode will not change when a file is updated.
#### hashLength
Type
Integer
Default 32Specifies the length of the hash used when renaming files. Default is 32 characters.
#### renameFormat
Type:
StringSpecifies the format to use when renaming files. Variables are specified using curly brackets (e.g., {variable}). Any other characters are directly included in the output.
Available variables include:
* {basename}: the base filename without extension
* {hash}: the hash value
* {extname}: the file extension
Default is "{basename}-hc{hash}{extname}".
#### continueOnError
Type
Boolean
Default FalseIgnore errors. Otherwise, hashly will abort on the first error.
#### continueOnPluginError
Type
Boolean
Default FalseIgnore errors from plugins. Takes precedence over continueOnError.
#### disabledPlugins
Type:
StringSemicolon-delimited list of plugin names that should be disabled.
#### cleanOldDays
Type
Integer
Default 0Deletes files that aren't in the manifest and are older than the specified number
#### sourcemapIncludePath
Type:
Boolean
Default: TrueInclude the absolute path to the source map in the JS/CSS source, relative to base-dir.
#### sourcemapURLPrefix
Type:
StringA URL prefix to apply to the source map tag, if it is not in the same location as the source.
$3
#### Basic usage
This configuration will output all hashed files and the manifest in place.
`js
grunt.initConfig({
hashly: {
my_target: {
basePath: "./staticFiles"
}
}
});
`#### Setting a targetPath
This configuration will output all hashed files and the manifest in the specified target directory.
`js
grunt.initConfig({
hashly: {
my_target: {
basePath: "./staticFiles",
targetPath: "./staticFilesProcessed"
}
}
});
`#### Setting the manifest format to 'tab'
This configuration will output all hashed files and the manifest in place, with the manifest in tab-delimited format.
`js
grunt.initConfig({
hashly: {
my_target: {
basePath: "./staticFiles",
options: {
manifestFormat: "tab"
}
}
}
});
`#### Setting an exclusion pattern
This configuration will exclude any *.pdf files from being hashed.
`js
grunt.initConfig({
hashly: {
my_target: {
basePath: "./staticFiles",
options: {
exclude: "*.pdf"
}
}
}
});
``