0.0.7 • Published 9 years ago

grunt-filesize v0.0.7

Weekly downloads
86
License
-
Repository
github
Last release
9 years ago

grunt-filesize

A Grunt plugin for logging filesize.

Documentation

modify your grunt.js file by adding the following line:

grunt.loadNpmTasks('grunt-filesize');

Then add some configuration for the plugin like so:

grunt.initConfig({
  ...
  filesize: {
    base: {
      files: [
        {expand: true, cwd: 'build', src: ['*.css', '*.js']}
      ],
      options: {
        ouput: [
          {
            stdout: true
          },
          {
            path: "output/file/{now:MMMDDYYYY}.csv",
            format: {filename},{size:0,0}
          },
          {
            path: "output/file/filename.txt",
            format: "{now:YYYY/MM/DD} {filename} {mb} mb",
            append: true
          }
        ]
      }
    }
  },
  ...
});

Options

format(string | function) not required.

Specify the format of the file to be output.

Specify the format in the placeholder if you have set in the String. Possible placeholder is as follows.

placeholdertypedescription
fullpathstringfull absolute file path
filenamestringfile name
basenamestringlast portion of a path
sizenumberfile size (bytes)
kbnumberfile size (kb)
mbnumberfile size (mb)
nowdateoutput date

Placeholder I enclosed in curly braces. It is possible to specify the color and format. Color is valid only if the standard output.

e.g.

{property,color:format}

Color specification the contents of the colors can be specified. Format specification can be specified only in the date type or numeric type. Date type format use the moment. Number type format use the numeral.

output(array | string) not required.

Output options is specify the output destination and format.

Possible property is as follows.

plopertytypedescription
stdoutbooloutput to console. If true is specified, the path property is ignored.
pathstringoutput file name. You can specify the place holder.
appendboolAppend the results to output file.
formatstring,functionSame format option

reporting(function) not required.

Obsolete.

Setting the 'reporting' option will generate a properties file on the given path for each file measured, you can use those in the Jenkins Plot plugin or other ways.

e.g.

options: {
  reporting: function (filePath) {
    return 'target/grunt/filesize/' + filePath + '.txt';
  }
},
0.0.7

9 years ago

0.0.6

9 years ago

0.0.4

10 years ago

0.0.5

10 years ago

0.0.2

10 years ago

0.0.1

11 years ago