File tree Expand file tree Collapse file tree 4 files changed +63
-2
lines changed Expand file tree Collapse file tree 4 files changed +63
-2
lines changed Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" standalone =" yes" ?>
22<rss xmlns : sparkle =" http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns : dc =" http://purl.org/dc/elements/1.1/" version =" 2.0" >
33 <channel >
4+ <item >
5+ <enclosure url =" https://github.com/Coding/coding-sketch-toolkit/releases/download/v0.4.0/coding-toolkit.sketchplugin.zip" sparkle : version =" 0.4.0" />
6+ </item >
47 <item >
58 <enclosure url =" https://github.com/Coding/coding-sketch-toolkit/releases/download/v0.3.0/coding-toolkit.sketchplugin.zip" sparkle : version =" 0.3.0" />
69 </item >
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ Dev Library 分类中的命令主要用于开发 Sketch Library 时使用。
88### 1. Update Icon 升级图标
99用于替换旧版 CODING Icon 至新版 CODING Icon,在设计稿中选中来自旧版的 CODING Icon Library 的 symbol 然后执行此命令即可自动替换为对应的新版 CODING ICON,并且保留原来 icon 覆盖的颜色。
1010
11- ### 2. Genrarte Icon Library Collection 生成图标合集
11+ ### 2. Generate Icon Library Collection 生成图标合集
1212用与在 CODING Icon Library 文件中修改或添加 icon 后重新生成 icon 集合,以便在 Abstract 中查找 icon。执行此命令将会自动删除原 Page 1 中的 icon collection 画板然后重新生成新的画板。
1313更新 CODING Icon 的具体方法请查看此 [ Wiki] ( https://codingcorp.coding.net/p/Design-Center/wiki/1495 )
1414
Original file line number Diff line number Diff line change 1+ const sketch = require ( 'sketch' )
2+
3+ export default function ( ) {
4+ const document = sketch . getSelectedDocument ( )
5+ const selection = document . selectedLayers . layers
6+
7+ function postIcon ( iconCatalog , iconName , iconCode ) {
8+ let requestOptions = {
9+ method : 'POST' ,
10+ headers : {
11+ "Authorization" : "Basic cHQxMTVrMnBmcDU0OmJmM2NiNWYzM2M0ZGU5ZmJlNmNjYWFhNjZhM2QwZmEwYzAxY2Q3ODk=" ,
12+ "Content-Type" : "application/json"
13+ } ,
14+ body : JSON . stringify ( {
15+ "ref" : "master" ,
16+ "envs" : [
17+ {
18+ "name" : "ICON_CATALOG" ,
19+ "value" : iconCatalog ,
20+ "sensitive" : 0
21+ } ,
22+ {
23+ "name" : "ICON_NAME" ,
24+ "value" : iconName ,
25+ "sensitive" : 0
26+ } ,
27+ {
28+ "name" : "ICON_CODE" ,
29+ "value" : iconCode . replace ( / " / g, '\\\"' ) ,
30+ "sensitive" : 0
31+ }
32+ ]
33+ } )
34+ }
35+
36+ fetch ( "https://codingcorp.coding.net/api/cci/job/168479/trigger" , requestOptions )
37+ . then ( response => response . text ( ) )
38+ . then ( result => console . log ( result ) )
39+ . catch ( error => console . log ( 'error' , error ) ) ;
40+ }
41+
42+ selection . map ( layer => {
43+ console . log ( layer )
44+ const options = { formats : 'svg' , output : false , compact : true }
45+ const sketchSVG = sketch . export ( layer , options )
46+ console . log ( sketchSVG . toString ( ) )
47+ postIcon ( "Arrow" , "right-arrow" , sketchSVG . toString ( ) )
48+ } )
49+
50+ sketch . UI . message ( "Well Done!" )
51+
52+ }
Original file line number Diff line number Diff line change 1818 "identifier" : " coding-toolkit.create-symbol-instance" ,
1919 "script" : " ./dev-library/create-symbol-instance.js"
2020 },
21+ {
22+ "name" : " Push New Icon To UIKit" ,
23+ "identifier" : " coding-toolkit.push-new-icon-to-uikit" ,
24+ "script" : " ./dev-library/push-new-icon-to-uikit.js"
25+ },
2126 {
2227 "script" : " data-supplier.js" ,
2328 "handlers" : {
4146 "title" : " Dev Library" ,
4247 "items" : [
4348 " coding-toolkit.generate-icons-collection" ,
44- " coding-toolkit.create-symbol-instance"
49+ " coding-toolkit.create-symbol-instance" ,
50+ " coding-toolkit.push-new-icon-to-uikit"
4551 ]
4652 }
4753 ]
You can’t perform that action at this time.
0 commit comments