forked from mattgodbolt/jsbeeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js.template
31 lines (31 loc) · 1.09 KB
/
build.js.template
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
{
COMMON_SETTINGS,
appDir: "build",
dir: "DEPLOY_DIR",
generateSourceMaps: true,
modules: [{name: "main-HASH"}],
optimize: "uglify2",
optimizeCss: "standard.keepLines",
preserveLicenseComments: false,
removeCombined: true,
useStrict: true,
oonModuleBundleComplete: function(data) {
var crypto = require('crypto'),
fs = require('fs');
var utils = require("./node_modules/grunt-hashres/tasks/hashresUtils");
var dest = [
'build/**/*.js-temp' // Bundle temporary file
];
var hsh = 'monkey';
var bundleName = data.name;
var bundleNewName = data.name + "." + hsh + ".cache";
// Substituting references to the given files with the hashed ones.
console.log(dest);
//grunt.file.expand(dest).forEach(function (f) {
//var destContents = fs.readFileSync(f, 'utf8');
//destContents = destContents.replace(new RegExp(utils.preg_quote(bundleName) + "(\\?[0-9a-z]+)?", "g"), bundleNewName);
//fs.writeFileSync(f, destContents, 'utf8');
//});
fs.renameSync("build/" + data.path, "build/" + bundleNewName + ".js");
}
}