svg-sprite / gulp-svg-sprite

SVG sprites & stacks galore — Gulp plugin wrapping around svg-sprite that reads in a bunch of SVG files, optimizes them and creates SVG sprites and CSS resources in various flavours
MIT License
648 stars 43 forks source link

Invalid mode configuration #22

Closed sanjaydev closed 9 years ago

sanjaydev commented 9 years ago

My Code in Gruntfile.js

svg_sprite      : {
            your_target: {
                cwd: 'images/svg/fixture',
                src: ['*.svg'],
                dest: 'images/svg/expected',
                options     : {
                   shape               : {
                    dimension       : {         // Set maximum dimensions 
                        maxWidth    : 32,
                        maxHeight   : 32
                    },
                    spacing         : {         // Add padding 
                        padding     : 10
                    },
                    dest            : 'out/intermediate-svg'    // Keep the intermediate files 
                },
                }
            }
        },

grunt.registerTask("start", ["svg_sprite"]);
grunt.loadNpmTasks('grunt-svg-sprite');

using run command: grunt svg_sprite

Getting error:
Warning: SVG sprite compilation failed with message: ArgumentError: SVGSpriter.compile: "{}" is not a valid mode configu ration Use --force to continue.

PLEASE HELP ME TO FIX THIS ISSUE.

jkphl commented 9 years ago

Hi @sanjaydev,

your configuration needs to enable at least one sprite mode. Please see here for further information about the output modes and / or use the configuration kickstarter for creating a config object.

Also, please give your issue a proper title and formating next time, that makes it easier to digest! ;)

Cheers and good luck, Joschi

cshold commented 8 years ago

What about the modeless option? I can't find a way to only optimize svgs without creating the sprite without getting this error.

jkphl commented 8 years ago

@cshold To be honest: I didn't try that in ages, might be broken?! If so, would you mind opening another issue? I'd go for SVGO alone if I only wanted to optimize the SVG.

In any case, as @sanjaydev added spacing and dimension options, I didn't expect him to optimize the SVGs only.

cshold commented 8 years ago

I tried going with SVGO alone, but it won't convert to symbol elements which is a big bummer. At some point in the svg sprite creation, I want to hijack it so the output goes to separate files instead of into a sprite. Any pointers, or is that well beyond the scope of this?

jkphl commented 8 years ago

Ah, right. SVGO of course does optimization only. On the other hand, with a modeless configuration (even if it worked) you wouldn't get symbols either, as this is exclusive to the symbol mode. I'll try to fix the modeless run however as soon as I can.