2017-09-14 55 views
1

當我運行 「咕嚕svgstore」 我得到這個:如何運行grunt svgstore?

否 「svgstore」 發現目標。警告:任務「svgstore」失敗。使用--force繼續。由於警告而中止。

爲什麼?

這是我的gruntfile的一部分(我不能發佈更多)。

 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']); 
}; 
+0

請提供[MCVE。 – ccprog

+0

請包括您的完整gruntfile –

+0

我編輯了我的帖子。這是我的gruntfile的主要部分。我無法粘貼整個文件。 – Ayala

回答

0

我有類似的問題。不知道什麼是解決方案,但我看了示例Gruntfile.js後,我已經解決了它。我和我的Gruntfile之間唯一的區別是我在initConfig之後調用了loadNpmTasks。

到這裏看看:

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']); 

};