Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>SongWukongNew to Visual Studio Code? Get it now.

SongWukong

dafengxiang

|
4 installs
| (1) | Free
自动读取剪切板图片链接,自动获取图片尺寸,根据自定义模版补全信息生成代码;也可基于乐趣静态资源上传api完成图片上传及代码生成。
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SongWukong - 图片代码生成插件

概述

自动读取剪切板图片链接,自动获取图片尺寸,根据自定义模版补全信息生成代码;也可基于乐趣静态资源上传api完成图片上传及代码生成。

插件配置项参数

参数 说明 类型 默认值
template 代码模版 String 见默认模版
withProtocol 图片链接是否保留协议 Boolean false
tinifykey 压缩 key(无参数不压缩) string -
authorization 图片上传乐趣 token(上传必要参数) String -

默认模版

.size({width}px,{height}px);
.po-absolute;
top: 0;
left: 0;
background: url('{url}') no-repeat center / {width}px {height}px;

配置项示例

"SongWukong": {
    "template": "background: url('{url}') no-repeat center / {width}px {height}px;",
    "withProtocol": false,
    "authorization": "api:XXXXXXXXXXX",
    "tinifykey": "XXXXXX"
}

template 模版参数

参数 说明 类型 备注
{width} 图片宽度 Number
{height} 图片高度 Number
{url} 图片链接 String

使用

读取剪切板链接生成代码

  • 右键 - 生成背景图代码
  • 快捷键(win: ctrl+g / mac: cmd+g)

选取图片上传乐趣生成代码(必须配置authorization)

  • 右键 - 选取图片上传
  • 快捷键(win: ctrl+i / mac: cmd+i)
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft