Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 tasks
Octocat-spinner-32 test
Octocat-spinner-32 .editorconfig
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .jshintrc
Octocat-spinner-32 .npmignore
Octocat-spinner-32 Gruntfile.js
Octocat-spinner-32 package.json
Octocat-spinner-32 readme.md
Octocat-spinner-32 screenshot.png
readme.md

grunt-sizediff

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

Something went wrong with that request. Please try again.