因此,我尝试在我的yo webapp(风琴手)中使用grunticon,但它说它无法读取任何文件。

Gruntfile.js:

   svgmin: {
        dist: {
            files: [{
                expand: true,
                cwd: '<%= config.app %>/images/svg-src/',
                src: '{,*/}*.svg',
                dest: '<%= config.dist %>/images/svg-src/'
            }]
        }
   },
   grunticon: {
         myIcons: {
               options: {
                   src: '<%= config.app %>/images/svg-src/',
                   dest: '<%= config.app %>/images/svg-dist/'
               }
         }
   },


完整的Gruntfile.js:https://gist.github.com/ricardobanegas/6c8c4ad3ac57f49728d7

补丁:https://gist.github.com/ricardobanegas/7f2933bfb8e58d7ef30c

Unix:

$ grunt grunticon:myIcons
Running "grunticon:myIcons" (grunticon) task
Look, it's a grunticon!
Grunticon has no files to read!

Done, without errors.


所以问题是,为什么Gruntfile.js不在app/images/svg-src/中找不到我的图像?

参考文献:

Grunticon

Yeoman+Grunticon install guidelines

有任何想法吗?

最佳答案

自版本1.0.0起已更改:https://github.com/filamentgroup/grunticon#whats-changed-in-this-major-version

看起来我在遵循旧教程。使用files: []代替options: {}解决了该问题:

grunticon: {
    myIcons: {
        files: [{
            expand: true,
            cwd: '<%= config.app %>/images/svg-src/',
            src: '{,*/}*.svg',
            dest: '<%= config.dist %>/images/svg-dist/'
         }],

         options: {

         }
        }
    },

07-24 09:48