grunt-svg2png中文文档|grunt-svg2png js中文教程|解析

npm npmdoc 2年前 (2021-12-30) 505次浏览

grunt-svg2png中文文档|grunt-svg2png js中文教程|解析

安装命令:npm i grunt-svg2png

grunt-svg2png

使用 PhantomJS 将 SVG 光栅化为 PNG 图像的 Grunt 插件

入门

这个插件需要Grunt ~0.4.1

// Gruntfile.js configuration
grunt.loadNpmTasks('grunt-svg2png');
 
grunt.initConfig({
    svg2png: {
        all: {
            // specify files in array format with multiple src-dest mapping
            files: [
                // rasterize all SVG files in "img" and its subdirectories to "img/png"
                { cwd: 'img/', src: ['**/*.svg'], dest: 'img/png/' }
            ]
        }
    }
});

此任务在SVGO GruntGrunt ImageOptim之间运行良好

更新

2014-06-23引入了路径修复无终端用例的选项您可能需要更新您的files配置以包含cwddest选项。


David Bushell创建| @dbushell

版权所有 © 2013 David Bushell | 麻省理工学院执照

项目贡献人员列表:


极客公园 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:grunt-svg2png中文文档|grunt-svg2png js中文教程|解析
喜欢 (0)
.excerpt .focus {display:none}