2.1.0 • Published 9 years ago
grunt-phantom-rasterize v2.1.0
grunt-phantom-rasterize
Installation
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 --save-dev grunt-phantom-rasterize
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-phantom-rasterize');
Documentation
See the Gruntfile in this repo for a full example.
Example Generating Icons for an iOS Application
grunt.initConfig({
rasterize : {
ios : {
options: {
sizes : [
{ width : 29, name : 'Icon-Small.png' },
{ width : 40, name : 'Icon-Small-40.png' },
{ width : 58, name : 'Icon-Small@2x.png' },
{ width : 76, name : 'Icon-76.png' },
{ width : 80, name : 'Icon-Small-40@2x.png' },
{ width : 87, name : 'Icon-Small@3x.png' },
{ width : 120, name : 'Icon-Small-40@3x.png' },
{ width : 120, name : 'Icon-60@2x.png' },
{ width : 152, name : 'Icon-76@2x.png' },
{ width : 180, name : 'Icon-60@3x.png' },
{ width : 512, name : 'iTunes@512.png' },
{ width : 1024, name : 'iTunes@1024.png' }
]
},
files: [
{
expand: true,
cwd: 'graphics/icons',
src: ['ios.svg'],
dest : 'ios-prod/'
},
{
expand: true,
cwd: 'graphics/icons',
src : ['ios-dev.svg'],
dest : 'ios-dev/'
}
]
}
}
});
grunt.loadNpmTasks("grunt-phantom-rasterize");
Tip: the grunt-newer module might come in handy if you have a large number of files.
License
unlicence