node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

grunt-polyfiller

grunt-polyfiller

npm version badge Build Status License

Grunt task for Polyfiller

Getting Started

This plugin requires Grunt ~0.4.5

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, you may install this plugin with this command:

npm install grunt-polyfiller --save-dev

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

grunt.loadNpmTasks('grunt-polyfiller');

grunt-polyfiller task

Run this task with the grunt polyfiller command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Usage Example

module.exports = function (grunt) {
    grunt.config.init({
        polyfiller: {
            build: {
                options: {
                    features: ['Promise', 'Fetch']
                },
 
                dest: 'polyfills.js'
            }
        }
    });
 
    grunt.loadNpmTasks('grunt-polyfiller');
    grunt.registerTask('default', ['polyfiller']);
};

Options

Type: Object.

All of options are the options for the Polyfiller itself, except these ones:

process

Type: Function(Object:feature, String:name, Array:features)

This option as an advanced way to control the file contents that are created.

....
options: {
    process: function (feature, name, features) {
        return feature.source;
    }
}
....

For more details see the Polyfiller documentation

Tests

grunt test

License

MIT

Task submitted by Alexander Abashkin