svg-sprite 介绍
svg-sprite 是一个低层次的 Node.js 模块,它可以将一堆 SVG 文件进行优化,然后将它们烤成几种类型的 SVG sprites
,并包含合适样式表的资源(例如 CSS, Sass, LESS, Stylus, etc.)
使用模式:
// Create spriter instance (see below for `config` examples) var spriter = new SVGSpriter(config); // Add SVG source files — the manual way ... spriter.add('assets/svg-1.svg', null, fs.readFileSync('assets/svg-1.svg', {encoding: 'utf-8'})); spriter.add('assets/svg-2.svg', null, fs.readFileSync('assets/svg-2.svg', {encoding: 'utf-8'})); /* ... */ // Compile the sprite spriter.compile(function(error, result) { /* ... Write `result` files to disk or do whatever with them ... */ });
svg-sprite 官网
https://github.com/jkphl/svg-sprite
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。