Grunt.js - Grunt-favicons 输出

4
我已经使用Grunt很长一段时间了,但这是第一次遇到这种情况。由于某种奇怪的原因,我无法让新的npm工具正常运行。我运行了npm install grunt-favicons --save-dev,它也能正常工作,我已经安装了ImageMagick等必要工具。我已经正确设置了路径和参数,并且已经执行了Grunt,而且似乎也没有出现任何问题。但是却没有生成文件。我已经检查了文件夹权限和一切相关内容。我只是好奇是否有聪明的人知道该怎么做。
Grunt任务:
favicons: {
    options: {
        trueColor: true,
        precomposed: false,
        coast: true,
        windowsTile: true,
        tileBlackWhite: true,
    },
    files: {
        src: ['<%= config.src %>/img/favicon.png'],
        dest: '<%= config.dest %>/img/icons/'
    }
},

控制台输出:
$ grunt favicons
Running "favicons:files" (favicons) task
>> Created output folder at " public/assets/img/icons/ "
Resizing images for "app/assets/img/favicon.png"... OK
favicon.ico... OK
favicon.png... OK
apple-touch-icon.png... OK
apple-touch-icon-60x60-precomposed.png... OK
apple-touch-icon-72x72.png... OK
apple-touch-icon-76x76-precomposed.png... OK
apple-touch-icon-114x114.png... OK
apple-touch-icon-120x120-precomposed.png... OK
apple-touch-icon-144x144.png... OK
apple-touch-icon-152x152-precomposed.png... OK
coast-icon-228x228.png... OK
windows-tile-144x144.png... OK
1个回答

2

grunt-favicons没有检查imagemagick的响应错误,因此可能所有的imagemagick命令都失败了,而grunt-favicons礼貌地告诉你“OK”。我猜测你可能缺少一个用于转换PNG的库。

你应该看到类似这样的东西:

$ convert -list configure | grep DELEGATES
DELEGATES      jng jpeg png ps zlib

如果缺少png,那就是你的问题了。执行sudo apt-get install libpng-dev命令,然后我认为你需要重新安装Imagemagick(我不确定,但这是我所做的)。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接