Permalink
Browse files

Make svgo optional

  • Loading branch information...
1 parent 7030432 commit ceb9c85292ac12103a26c9f2586b6bc4e447f41d @jefflembeck jefflembeck committed Jul 23, 2013
Showing with 7 additions and 4 deletions.
  1. +2 −0 Gruntfile.js
  2. +1 −0 README.md
  3. +1 −1 package.json
  4. +3 −3 tasks/grunticon.js
View
2 Gruntfile.js
@@ -21,6 +21,8 @@ module.exports = function(grunt) {
dest: "example/output/",
// optional grunticon config properties
+ // SVGO compression, true is the default, false will skip it
+ svgo: true,
// CSS filenames
datasvgcss: "icons.data.svg.css",
View
1 README.md
@@ -88,6 +88,7 @@ grunticon will now batch your icons whenever you run grunt.
In addition to the required configuration properties above, grunticon's grunt configuration lets you configure the names of the files and the images folder it generates inside `dest`.
+- `svgo`: Choose whether or not you would like to use SVGO to optimize your SVG files. Default: `true`
- `datasvgcss`: The name of the generated CSS file containing SVG data uris. Default: `"icons.data.svg.css"`
- `datapngcss`: The name of the generated CSS file containing PNG data uris. Default: `"icons.data.png.css"`
- `urlpngcss`: The name of the generated CSS file containing external png url references. Default: `"icons.fallback.css"`
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "grunt-grunticon",
"description": "A mystical CSS icon solution",
- "version": "0.5.0",
+ "version": "0.5.1",
"homepage": "https://github.com/filamentgroup/grunticon",
"author": {
"name": "Scott Jehl",
View
6 tasks/grunticon.js
@@ -44,10 +44,10 @@ module.exports = function( grunt , undefined ) {
return promise;
};
- var optimize = function( file , data ){
+ var optimize = function( file , data , opt ){
var promise = new RSVP.Promise();
try{
- if( file.match( /png/ ) ){
+ if( file.match( /png/ ) || !opt ){
promise.resolve( data );
} else {
svgo.optimize( data.toString() , function( result ){
@@ -178,7 +178,7 @@ module.exports = function( grunt , undefined ) {
grunt.fatal( err );
done( false );
}
- return optimize( file , data );
+ return optimize( file , data , config.svgo );
})
.then( function( result , err ){
if( err ){

0 comments on commit ceb9c85

Please sign in to comment.