0

My grunt file looks like:

module.exports = function( grunt ) {

grunt.initConfig({
    svg_sprite      : {
        options     : {
        },
        your_target : {
            expand      : true,
            src         : [ 
                            'A-checkmarkblack.svg',
                            'B-checkmarkpurple.svg',
                            'C-checkmarkwhite.svg',
                            'D-emptyheart.svg',
                            'E-message.svg',
                            'F-heartIcon.svg',
                            'G-share-alt.svg',
                            'H-tag.svg',
                            'I-camera.svg',
                            'J-down.svg',
                            'K-up.svg',
                        ],
            dest        : 'images',
            options: {
                shape: {
                    dimension: {
                        maxWidth: 200,
                        maxHeight: 60
                    },
                    spacing : {
                        padding: 2
                    },
                }, 
                mode: {
                    css     : {
                        bust: false,
                        layout: "horizontal"
                    },


                },
            }
        }
    }
});

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

};

If you see the names of SVG icons, I have used A, B, C ...and so on for naming them. Grunt-SVG-Sprite makes the sprite by taking the name of icons alphabetically. Thus the reason why I added A,B,C..is if I add any more icons, I will include them as K,L.. so that they append at the last in existing sprite, not interfering the existing icons and their background properties. How do I ensure that the new icons added to my folder will only append at the last?

EDIT: Solved this second issue (see my comment):

Second issue is the name of the sprite generated. As per current grunt file, it generates sprite.css.svg . I want to name it as say, MyIcons.svg, how do I do it?

PageSource
  • 301
  • 3
  • 11
  • Ok. I have figured out how to name it according to my needs, just added a property sprite: "MyIcons.svg" inside mode. And I got it. But I still need to know how do I append new icons only at the last of existing sprite, not taking alphabetical order into account. – PageSource Oct 14 '15 at 05:25
  • BUMP! I still want to know how do I avoid the alphabetical order of icons and append the new icons to a existing sprite irrespective of their names. – PageSource Nov 17 '15 at 09:42

0 Answers0