Ayala
Ayala

Reputation: 117

How can I run grunt svgstore?

When I run "grunt svgstore" I get this:

No "svgstore" targets found. Warning: Task "svgstore" failed. Use --force to continue. Aborted due to warnings.

Why?

This is part of my gruntfile (I can't post more).

      module.exports = function(grunt) {


  grunt.loadNpmTasks('grunt-svgstore');



  grunt.initConfig({

      svgstore: {
      options: {
        formatting : {
          indent_size : 2
        }
      },
        default: {
          files: {
          'images/svg/defs.svg': ['images/svg/*.svg'],
        },
      },
    },

    },





  });

// Default task(s)
  grunt.registerTask('default', ['sass_globbing', /*'sprite:icons_dev'*/, 'sass']);
  grunt.registerTask('icon_sprite', ['sprite:icons_dev']);




  //grunt.registerTask('stage_deploy', ['sass_globbing', 'sprite:flags_dev', 'sprite:icons_dev', 'sass']);
  //grunt.registerTask('prod_deploy', ['sass_globbing', 'sprite:flags_prod', 'sprite:icons_prod', 'tinypng', 'sass']);
};

Upvotes: 1

Views: 1258

Answers (1)

Marek Dlugos
Marek Dlugos

Reputation: 197

I had a similar problem. Not sure what is the solution but I have solved it after I took a look on sample Gruntfile.js. The only difference I can spot between mine and yours Gruntfile is that I call loadNpmTasks after initConfig.

Take a look here:

module.exports = function(grunt) {

  grunt.initConfig({
    svgstore: {
      options: {
        prefix : 'pfx-', // This will prefix each ID
        svg: { // will add and overide the the default xmlns="http://www.w3.org/2000/svg" attribute to the resulting SVG
          viewBox : '0 0 100 100',
          xmlns: 'http://www.w3.org/2000/svg'
        },
        formatting : {
          indent_size : 2
        },
        symbol : {},
        includedemo: true,
        cleanup: true,
        cleanupdefs: true,
      },
      default : {
        files: {
          'export/pfx-icons.svg': ['svgs/*.svg'],
        },
      },
    },
  });

  grunt.loadNpmTasks('grunt-svgstore');

  grunt.registerTask('default', ['svgstore']);

};

Upvotes: 0

Related Questions