re-added json minifier
@@ -167,3 +167,28 @@ publishing {
}
}
}
+
+processResources {
+ doLast {
+
+ def jsonMinifyStart = System.currentTimeMillis()
+ def jsonMinified = 0
+ def jsonBytesSaved = 0
+
+ fileTree(dir: outputs.files.asPath, include: '**/*.json').each {
+
+ File file = it
+ jsonMinified++
+ def oldLength = file.length()
+ try {
+ file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
+ } catch(JsonException e) {
+ throw new JsonException("Failed to parse json in " + file.path)
+ }
+ file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
+ jsonBytesSaved += oldLength - file.length()
+ }
+
+ println('Minified ' + jsonMinified + ' json files. Saved ' + jsonBytesSaved + ' bytes. Took ' + (System.currentTimeMillis() - jsonMinifyStart) + 'ms.')
+ }
+}
