Permalink
Browse files

initial commit

  • Loading branch information...
1 parent d7407a8 commit 7719284fdb716b7c374ab829b53b14431b611c04 @k-maru committed Nov 24, 2012
Showing with 24 additions and 0 deletions.
  1. +5 −0 grunt.js
  2. +19 −0 tasks/filesize.js
View
@@ -0,0 +1,5 @@
+module.exports = function(grunt) {
+ grunt.initConfig({});
+ // Load local tasks.
+ grunt.loadTasks('tasks');
+};
View
@@ -0,0 +1,19 @@
+module.exports = function(grunt) {
+
+ 'use strict';
+
+ var fs = require('fs');
+
+ grunt.registerMultiTask('filesize', 'logging file size', function() {
+
+ var files = grunt.file.expandFiles(this.data.files);
+ files.forEach(function(item, index){
+ if(!fs.existsSync(item)){
+ grunt.log.writeln(item + ": not found.");
+ }else{
+ var stat = fs.statSync(item);
+ grunt.log.writeln(item + ": " + String((stat.size / 1024).toFixed(2)).green + " kb (" + String(stat.size).green + " bytes)");
+ }
+ });
+ });
+};

0 comments on commit 7719284

Please sign in to comment.