Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make svgo optional

  • Loading branch information...
commit ceb9c85292ac12103a26c9f2586b6bc4e447f41d 1 parent 7030432
Jeff Lembeck jefflembeck authored
2  Gruntfile.js
View
@@ -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",
1  README.md
View
@@ -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"`
2  package.json
View
@@ -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",
6 tasks/grunticon.js
View
@@ -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 ){
Please sign in to comment.
Something went wrong with that request. Please try again.