Code Monkey home page Code Monkey logo

grunt-filesize's Introduction

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.

placeholder type description
fullpath string full absolute file path
filename string file name
basename string last portion of a path
size number file size (bytes)
kb number file size (kb)
mb number file size (mb)
now date output 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.

ploperty type description
stdout bool output to console. If true is specified, the path property is ignored.
path string output file name. You can specify the place holder.
append bool Append the results to output file.
format string,function Same 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';
  }
},

grunt-filesize's People

Contributors

k-maru avatar kmaru avatar michaek avatar stanleyhlng avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.