grunt-smushit
Grunt plugin to remove unnecessary bytes of PNG and JPG using reSmush.it
reSmush.it is a FREE alternative to Yahoo Smush.it (deprecated on March 2015). This tool provides a online way to optimize pictures size via a documented webservice.
Prefer Gulp? gulp-smushit
Getting Started
This plugin requires Grunt 0.4.x
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-smushit --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "smushit" task
Overview
In your project's Gruntfile, add a section named smushit
to the data object passed into grunt.initConfig()
.
grunt;
Options
options.service
Type: String
Default value: null
Call another service instead of Yahoo Smushit
options.verbose
Type: boolean
Default value: true
Show image compressing rate log
Usage Examples
Output Folder
Move your files to a target folder (should not be into the same).
grunt;
Replace files
Be safe to replace all of your old files with this option.
grunt;
Work with a nested folder
Recursively walk into folders and smushit files
grunt;
Provide multiple source
Smushit one folder, or many of them
grunt;
Use of cwd
Provide your base directory
grunt;
Your own service
There is an option that you can set your own image optimizer service. Its a good alternative if you don't want to wait for smush.it web service latency.
grunt;
Contributing
$ git clone git://github.com/heldr/grunt-smushit.git$ cd grunt-smushit$ npm install$ npm test
NOTE: Be sure to keep up to date the plugin tests and jshint code quality.
Release History
- 2015-09-05 v2.0.0 Use resmush.it due Yahoo Smushit deprecation
- 2014-05-19 v1.3.0 Pass node-smushit options through grunt file
- 2014-03-30 v1.2.1 Bugfix. Fixes issue 29
- 2014-03-03 v1.2.0 Use cwd only for source files, following the grunt pattern
- 2013-07-15 v1.1.0 Support nested folder structure, support for multiple source folders
- 2013-07-15 v1.1.0 Enable the use of cwd parameter
- 2013-06-16 v1.0.0 Rewrite task on top of grunt-init-gruntplugin
- 2013-05-26 v0.4.2 Add support to different service #16
Credits
License
MIT License (c) Helder Santana