Skip to content
Browse files

0.1.2 - report file sizes in KB

  • Loading branch information...
1 parent ba8aa1a commit 21c9ebfe14d239070d4309e5b8fa56a637368ea5 @insin committed Feb 4, 2012
Showing with 14 additions and 3 deletions.
  1. +5 −0 CHANGES.rst
  2. +8 −2 lib/buildumb.js
  3. +1 −1 package.json
View
5 CHANGES.rst
@@ -1,3 +1,8 @@
+0.1.2 / 2012-02--04
+==================
+
+* File sizes from the Closure Compiler API are now reported in KB
+
0.1.1 / 2012-01-30
==================
View
10 lib/buildumb.js
@@ -9,6 +9,10 @@ function normjoin(path1, path2) {
return path.normalize(path.join(path1, path2))
}
+function kb(bytes) {
+ return (bytes / 1024).toFixed(2) + 'KB'
+}
+
/**
* Reads a template string from the given path and formats it with any
* additional arguments given.
@@ -92,9 +96,11 @@ exports.build = function(config) {
if (!result.hasOwnProperty('errors')) {
console.log('statistics:')
console.log(' original size: %s (%s gzipped)',
- result.statistics.originalSize, result.statistics.originalGzipSize)
+ kb(result.statistics.originalSize),
+ kb(result.statistics.originalGzipSize))
console.log(' compressed size: %s (%s gzipped)',
- result.statistics.compressedSize, result.statistics.compressedGzipSize)
+ kb(result.statistics.compressedSize),
+ kb(result.statistics.compressedGzipSize))
console.log('compressed: %s', compressedOutputPath)
fs.writeFileSync(compressedOutputPath, config.header + result.compiledCode)
}
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "buildumb"
, "description": "Ultra-dumb exporter of Node.js modules for use in the browser"
-, "version": "0.1.1"
+, "version": "0.1.2"
, "author": "Jonathan Buchanan <jonathan.buchanan@gmail.com> (https://github.com/insin)"
, "tags": ["build", "export", "browser", "modules"]
, "main": "./lib/buildumb"

0 comments on commit 21c9ebf

Please sign in to comment.
Something went wrong with that request. Please try again.