min.js 791 B

1234567891011121314151617181920212223242526272829303132
  1. // TODO: PUT THIS SOMEWHERE CENTRALIZED
  2. /*
  3. * grunt-contrib-uglify
  4. * https://gruntjs.com/
  5. *
  6. * Copyright (c) 2012 "Cowboy" Ben Alman, contributors
  7. * Licensed under the MIT license.
  8. */
  9. 'use strict';
  10. // External libs.
  11. var gzip = require('gzip-js');
  12. exports.init = function(grunt) {
  13. var exports = {};
  14. // Return gzipped source.
  15. exports.gzip = function(src) {
  16. return src ? gzip.zip(src, {}) : '';
  17. };
  18. // Output some size info about a file.
  19. exports.info = function(min, max) {
  20. var gzipSize = String(exports.gzip(min).length);
  21. grunt.log.writeln('Uncompressed size: ' + String(max.length).green + ' bytes.');
  22. grunt.log.writeln('Compressed size: ' + gzipSize.green + ' bytes gzipped (' + String(min.length).green + ' bytes minified).');
  23. };
  24. return exports;
  25. };