optimize images with punypng.
This plugin requires Grunt ~0.4.4
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-punypng --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-punypng');
In your project's Gruntfile, add a section named punypng
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
punypng: {
options: {
key: 'cd1e2670d3167db696ea56b8ck965fd3620a579cb'
},
test: {
files: [{
src: 'test/fixtures/*.png',
dest: 'test/expected/'
}]
}
},
});
Type: key
Default value: ', '
用于识别punypng账户的key,注册punypny账户后可以获得(http://www.punypng.com/profile)
Type: lossy
Default value: 'true'
是否使用有损的压缩方式。推荐使用有损的压缩方式,有损的压缩是punypng的核心优势
In this example, the default options are used to do something with whatever. So if the testing
file has the content Testing
and the 123
file had the content 1 2 3
, the generated result would be Testing, 1 2 3.
grunt.initConfig({
punypng: {
options: {
// you can get key at http://www.punypng.com/profile
key: 'cd1e2670d3167db696ea56b8c965fd3620a579cb'
},
test: {
files: [{
src: 'test/fixtures/*.png',
dest: 'test/expected/'
}]
}
},
});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)