/
dactylographsy.js
49 lines (44 loc) · 1.15 KB
/
dactylographsy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* grunt-dactylographsy
* https://github.com/dactylographsy/grunt-dactylographsy
*
* Copyright (c) 2016 tdeekens
* Licensed under the MIT license.
*/
module.exports = function(grunt) {
var
Persister = require('node-dactylographsy').Persister,
Fingerprinter = require('node-dactylographsy').Fingerprinter,
FileAnalyzer = require('node-dactylographsy').FileAnalyzer;
grunt.registerMultiTask('dactylographsy', 'Fingerprint your assets', function() {
var
options = this.options({
location: 'dactylographsy.json',
root: 'dist',
rootUrl: null,
packageUrl: null,
devPaths: [],
package: 'None'
});
var
files,
prints,
fileAnalyzer = new FileAnalyzer(
options.root
),
fingerprinter = new Fingerprinter(
options.root,
options.devPaths
),
persister = new Persister(
options.package,
options.root,
options.location,
options.rootUrl,
options.packageUrl
);
files = fileAnalyzer.getFiles(this.files);
prints = fingerprinter.hashFiles(files);
persister.write(prints);
});
};