grunt-sizediff

Diff file sizes between current git branch and a branch/commit

npm install grunt-sizediff
2 downloads in the last week
35 downloads in the last month

grunt-sizediff Built with Grunt

Diff file sizes between current git branch and a branch/commit.
It helps you keep an eye on your project size changes.

screenshot

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide, as it explains how to create a gruntfile as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:

npm install grunt-sizediff --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-sizediff');

Tip: the load-grunt-tasks module makes it easier to load multiple grunt tasks.

Documentation

You can specify two files to diff and an optional target.

Example usage

Diff

sizediff: {
    dist: {
        src: [
            'file.js',
            'file.min.js' // optional
        ]
    }
}

It falls back to master if target is not specified.

Diff against branch

sizediff: {
    dist: {
        options: {
            target: 'future' // branch
        },
        src: [
            'file.js',
            'file.min.js'
        ]
    }
}

Diff against commit

sizediff: {
    dist: {
        options: {
            target: 'fd9b092' // commit
        },
        src: [
            'file.js',
            'file.min.js'
        ]
    }
}

Override target

You can temporarily override the diff target of a task by running grunt sizediff:dist:target, where dist is the task target you want to override and target is the branch or commit.

Tests

Grunt currently doesn't have a way to test tasks directly. You can test this task by running grunt and manually verify that it works.

License

MIT © Sindre Sorhus

npm loves you