#svg #gif #webp #png #image #command-line #command-line-tool

bin+lib emoji-crafter

一个用于从 SVG 自动导出表情符号(包括动画)的命令行工具

5 个版本

0.1.3 2022 年 6 月 28 日
0.1.2 2021 年 9 月 13 日
0.1.1 2021 年 9 月 12 日
0.1.0 2021 年 9 月 12 日
0.0.0 2021 年 9 月 10 日

#534模板引擎

每月 23 次下载

自定义许可

100KB
901

emoji crafter

一个用于从 SVG 自动导出表情符号(包括动画)的命令行工具。

安装

可以使用 cargo 安装 emoji crafter

cargo install emoji-crafter

工作原理

要创建一个新的表情符号集项目,只需使用 new 命令并提供您项目的路径/名称

emoji new my-emojis

然后切换到命令创建的新项目目录。

要导出您的表情符号集,请运行以下操作

emoji build # to build once
emoji watch # to build on file change

清单格式

表情符号集清单文件(emoji.toml),用于定义项目使用的资产以及在构建时导出的内容。

[emojiset]
# human readable name for the project
name = "my emojis"
# the main svg file that contains
# emoji to be exported
document = "emojiset.svg"
# editor stylesheet, imported in the
# document and only used for styling
# while editing
stylesheet = "emojiset.css"

[[theme]]
# human readable name for the theme
name = "my emojis"
# all files exported using this
# theme will have their filenames
# prefixed with this
prefix = ""
# stylesheet used for rendering
# emoji for the theme
stylesheet = "themes/my emojis.css"

[[output]]
# not all platforms work well with
# emoji that aren't square, so the
# option to trim is disabled
trim = false
directory = "original"

[[output]]
# some platforms work best with the
# transparent parts cropped from
# the emoji
trim = true
directory = "trimmed"

除了项目创建时定义的内容外,您还可以定义模板以渲染文本文件

[[template]]
# path to the template
input = "my template.tpl"
# where the template should be saved
output = "my document.md"

您可以使用 tinytemplate 语法来构建您的模板。

表情符号集格式

每个表情符号是一个包含描述的组,描述了该组应该如何导出。对于静态图像表情符号,其外观如下

type = "image"
# name of the emoji, prefixed with
# a theme name on export
name = "bunne"

动画与此类似

type = "animation"
name = "bunnehop"

但是它们还包含组成动画单个帧的组

type = "frame"
# delay before the next frame in ms
delay = 60
# animation timeline position
position = 1

是的,我对大写字母过敏,不,我不会正确拼写 bunne

依赖项

~20–33MB
~501K SLoC