微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

svg-sprite Node.js 模块

程序名称:svg-sprite

授权协议: MIT

操作系统: 跨平台

开发语言: JavaScript

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] 举报,一经查实,本站将立刻删除。

相关推荐