@winjs-dev/create-win 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +195 -0
  3. package/bin/create-win.js +4 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +23 -0
  6. package/dist/index.d.ts +45 -0
  7. package/dist/index.js +396 -0
  8. package/dist/template.d.ts +13 -0
  9. package/dist/template.js +123 -0
  10. package/package.json +36 -0
  11. package/templates/app/.cursor/rules/clean-code.mdc +55 -0
  12. package/templates/app/.cursor/rules/general.mdc +51 -0
  13. package/templates/app/.cursor/rules/git-conventional-commit-messages.mdc +127 -0
  14. package/templates/app/.cursor/rules/gitflow.mdc +111 -0
  15. package/templates/app/.cursor/rules/project-structure.mdc +69 -0
  16. package/templates/app/.cursor/rules/typescript.mdc +57 -0
  17. package/templates/app/.cursor/rules/vue.mdc +86 -0
  18. package/templates/app/.editorconfig.tpl +23 -0
  19. package/templates/app/.eslintignore +13 -0
  20. package/templates/app/.eslintrc.js +9 -0
  21. package/templates/app/.gitignore.tpl +55 -0
  22. package/templates/app/.husky/commit-msg +6 -0
  23. package/templates/app/.husky/pre-commit +5 -0
  24. package/templates/app/.lintstagedrc.tpl +5 -0
  25. package/templates/app/.npmrc.tpl +2 -0
  26. package/templates/app/.prettierignore +13 -0
  27. package/templates/app/.prettierrc.js +4 -0
  28. package/templates/app/.stylelintignore +6 -0
  29. package/templates/app/.stylelintrc.js +16 -0
  30. package/templates/app/.winrc.ts.tpl +95 -0
  31. package/templates/app/README.md +244 -0
  32. package/templates/app/commitlint.config.js +3 -0
  33. package/templates/app/f2elint.config.js +6 -0
  34. package/templates/app/package.json.tpl +34 -0
  35. package/templates/app/plugin.ts.tpl +23 -0
  36. package/templates/app/src/app.js +55 -0
  37. package/templates/app/src/assets/fonts/demo.css +412 -0
  38. package/templates/app/src/assets/fonts/demo_fontclass.html +42 -0
  39. package/templates/app/src/assets/fonts/demo_symbol.html +69 -0
  40. package/templates/app/src/assets/fonts/demo_unicode.html +77 -0
  41. package/templates/app/src/assets/fonts/iconfont.css +20 -0
  42. package/templates/app/src/assets/fonts/iconfont.eot +0 -0
  43. package/templates/app/src/assets/fonts/iconfont.js +96 -0
  44. package/templates/app/src/assets/fonts/iconfont.svg +36 -0
  45. package/templates/app/src/assets/fonts/iconfont.ttf +0 -0
  46. package/templates/app/src/assets/fonts/iconfont.woff +0 -0
  47. package/templates/app/src/assets/img/logo.png +0 -0
  48. package/templates/app/src/assets/js/.gitkeep +0 -0
  49. package/templates/app/src/assets/style/app.less +5 -0
  50. package/templates/app/src/assets/style/main.less +39 -0
  51. package/templates/app/src/assets/style/variable.less +53 -0
  52. package/templates/app/src/constant.js +5 -0
  53. package/templates/app/src/global.less +1 -0
  54. package/templates/app/src/icons/cat.svg +1 -0
  55. package/templates/app/src/icons/dog.svg +1 -0
  56. package/templates/app/src/layouts/index.vue +15 -0
  57. package/templates/app/src/pages/docs.vue +5 -0
  58. package/templates/app/src/pages/hello/index.vue +88 -0
  59. package/templates/app/src/pages/hello/style.less +41 -0
  60. package/templates/app/src/pages/index.vue +9 -0
  61. package/templates/app/src/services/RESTFULURL.js +3 -0
  62. package/templates/app/src/services/autoMatchBaseUrl.js +18 -0
  63. package/templates/app/src/services/index.js +11 -0
  64. package/templates/app/src/services/request.js +178 -0
  65. package/templates/app/tsconfig.json.tpl +3 -0
  66. package/templates/app/typings.d.ts +1 -0
  67. package/templates/pc/.cursor/rules/clean-code.mdc +55 -0
  68. package/templates/pc/.cursor/rules/general.mdc +51 -0
  69. package/templates/pc/.cursor/rules/git-conventional-commit-messages.mdc +127 -0
  70. package/templates/pc/.cursor/rules/gitflow.mdc +111 -0
  71. package/templates/pc/.cursor/rules/project-structure.mdc +69 -0
  72. package/templates/pc/.cursor/rules/typescript.mdc +57 -0
  73. package/templates/pc/.cursor/rules/vue.mdc +86 -0
  74. package/templates/pc/.editorconfig.tpl +23 -0
  75. package/templates/pc/.eslintignore +13 -0
  76. package/templates/pc/.eslintrc.js +9 -0
  77. package/templates/pc/.gitignore.tpl +54 -0
  78. package/templates/pc/.husky/commit-msg +6 -0
  79. package/templates/pc/.husky/pre-commit +5 -0
  80. package/templates/pc/.lintstagedrc.tpl +5 -0
  81. package/templates/pc/.npmrc.tpl +2 -0
  82. package/templates/pc/.prettierignore +13 -0
  83. package/templates/pc/.prettierrc.js +4 -0
  84. package/templates/pc/.stylelintignore +6 -0
  85. package/templates/pc/.stylelintrc.js +16 -0
  86. package/templates/pc/.winrc.ts.tpl +74 -0
  87. package/templates/pc/README.md +255 -0
  88. package/templates/pc/commitlint.config.js +3 -0
  89. package/templates/pc/f2elint.config.js +6 -0
  90. package/templates/pc/package.json.tpl +33 -0
  91. package/templates/pc/plugin.ts.tpl +23 -0
  92. package/templates/pc/src/app.js +55 -0
  93. package/templates/pc/src/assets/fonts/demo.css +412 -0
  94. package/templates/pc/src/assets/fonts/demo_fontclass.html +42 -0
  95. package/templates/pc/src/assets/fonts/demo_symbol.html +69 -0
  96. package/templates/pc/src/assets/fonts/demo_unicode.html +77 -0
  97. package/templates/pc/src/assets/fonts/iconfont.css +20 -0
  98. package/templates/pc/src/assets/fonts/iconfont.eot +0 -0
  99. package/templates/pc/src/assets/fonts/iconfont.js +96 -0
  100. package/templates/pc/src/assets/fonts/iconfont.svg +36 -0
  101. package/templates/pc/src/assets/fonts/iconfont.ttf +0 -0
  102. package/templates/pc/src/assets/fonts/iconfont.woff +0 -0
  103. package/templates/pc/src/assets/img/logo.png +0 -0
  104. package/templates/pc/src/assets/js/.gitkeep +0 -0
  105. package/templates/pc/src/assets/style/app.less +5 -0
  106. package/templates/pc/src/assets/style/main.less +39 -0
  107. package/templates/pc/src/assets/style/variable.less +53 -0
  108. package/templates/pc/src/constant.js +5 -0
  109. package/templates/pc/src/global.less +1 -0
  110. package/templates/pc/src/icons/cat.svg +1 -0
  111. package/templates/pc/src/icons/dog.svg +1 -0
  112. package/templates/pc/src/layouts/index.vue +16 -0
  113. package/templates/pc/src/pages/docs.vue +5 -0
  114. package/templates/pc/src/pages/hello/index.vue +88 -0
  115. package/templates/pc/src/pages/hello/style.less +41 -0
  116. package/templates/pc/src/pages/index.vue +9 -0
  117. package/templates/pc/src/services/RESTFULURL.js +3 -0
  118. package/templates/pc/src/services/autoMatchBaseUrl.js +18 -0
  119. package/templates/pc/src/services/index.js +11 -0
  120. package/templates/pc/src/services/request.js +178 -0
  121. package/templates/pc/tsconfig.json.tpl +3 -0
  122. package/templates/pc/typings.d.ts +1 -0
  123. package/templates/plugin/.fatherrc.ts +5 -0
  124. package/templates/plugin/.gitignore.tpl +2 -0
  125. package/templates/plugin/.npmrc.tpl +2 -0
  126. package/templates/plugin/README.md.tpl +29 -0
  127. package/templates/plugin/package.json.tpl +26 -0
  128. package/templates/plugin/src/index.ts.tpl +5 -0
  129. package/templates/plugin/tsconfig.json +19 -0
  130. package/templates/sample/.cursor/rules/clean-code.mdc +55 -0
  131. package/templates/sample/.cursor/rules/general.mdc +51 -0
  132. package/templates/sample/.cursor/rules/git-conventional-commit-messages.mdc +127 -0
  133. package/templates/sample/.cursor/rules/gitflow.mdc +111 -0
  134. package/templates/sample/.cursor/rules/project-structure.mdc +69 -0
  135. package/templates/sample/.cursor/rules/typescript.mdc +57 -0
  136. package/templates/sample/.cursor/rules/vue.mdc +86 -0
  137. package/templates/sample/.editorconfig.tpl +23 -0
  138. package/templates/sample/.gitignore.tpl +19 -0
  139. package/templates/sample/.npmrc.tpl +2 -0
  140. package/templates/sample/.winrc.ts.tpl +7 -0
  141. package/templates/sample/package.json.tpl +21 -0
  142. package/templates/sample/plugin.ts.tpl +7 -0
  143. package/templates/sample/src/assets/img/logo.png +0 -0
  144. package/templates/sample/src/layouts/index.vue +8 -0
  145. package/templates/sample/src/pages/docs.vue +5 -0
  146. package/templates/sample/src/pages/hello/index.vue +77 -0
  147. package/templates/sample/src/pages/hello/style.less +41 -0
  148. package/templates/sample/src/pages/index.vue +9 -0
  149. package/templates/sample/tsconfig.json.tpl +3 -0
  150. package/templates/sample/typings.d.ts +1 -0
@@ -0,0 +1,412 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ list-style: none;
5
+ }
6
+ /*
7
+ KISSY CSS Reset
8
+ 理念:1. reset 的目的不是清除浏览器的默认样式,这仅是部分工作。清除和重置是紧密不可分的。
9
+ 2. reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。
10
+ 3. reset 期望提供一套普适通用的基础样式。但没有银弹,推荐根据具体需求,裁剪和修改后再使用。
11
+ 特色:1. 适应中文;2. 基于最新主流浏览器。
12
+ 维护:玉伯<lifesinger@gmail.com>, 正淳<ragecarrier@gmail.com>
13
+ */
14
+
15
+ /** 清除内外边距 **/
16
+ body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */
17
+ dl, dt, dd, ul, ol, li, /* list elements 列表元素 */
18
+ pre, /* text formatting elements 文本格式元素 */
19
+ form, fieldset, legend, button, input, textarea, /* form elements 表单元素 */
20
+ th, td /* table elements 表格元素 */ {
21
+ margin: 0;
22
+ padding: 0;
23
+ }
24
+
25
+ /** 设置默认字体 **/
26
+ body,
27
+ button, input, select, textarea /* for ie */ {
28
+ font: 12px/1.5 tahoma, arial, \5b8b\4f53, sans-serif;
29
+ }
30
+ h1,
31
+ h2,
32
+ h3,
33
+ h4,
34
+ h5,
35
+ h6 {
36
+ font-size: 100%;
37
+ }
38
+ address,
39
+ cite,
40
+ dfn,
41
+ em,
42
+ var {
43
+ font-style: normal;
44
+ } /* 将斜体扶正 */
45
+ code,
46
+ kbd,
47
+ pre,
48
+ samp {
49
+ font-family: courier new, courier, monospace;
50
+ } /* 统一等宽字体 */
51
+ small {
52
+ font-size: 12px;
53
+ } /* 小于 12px 的中文很难阅读,让 small 正常化 */
54
+
55
+ /** 重置列表元素 **/
56
+ ul,
57
+ ol {
58
+ list-style: none;
59
+ }
60
+
61
+ /** 重置文本格式元素 **/
62
+ a {
63
+ text-decoration: none;
64
+ }
65
+ a:hover {
66
+ text-decoration: underline;
67
+ }
68
+
69
+ /** 重置表单元素 **/
70
+ legend {
71
+ color: #000;
72
+ } /* for ie6 */
73
+ fieldset,
74
+ img {
75
+ border: 0;
76
+ } /* img 搭车:让链接里的 img 无边框 */
77
+ button,
78
+ input,
79
+ select,
80
+ textarea {
81
+ font-size: 100%;
82
+ } /* 使得表单元素在 ie 下能继承字体大小 */
83
+ /* 注:optgroup 无法扶正 */
84
+
85
+ /** 重置表格元素 **/
86
+ table {
87
+ border-collapse: collapse;
88
+ border-spacing: 0;
89
+ }
90
+
91
+ /* 清除浮动 */
92
+ .ks-clear:after,
93
+ .clear:after {
94
+ content: "\20";
95
+ display: block;
96
+ height: 0;
97
+ clear: both;
98
+ }
99
+ .ks-clear,
100
+ .clear {
101
+ *zoom: 1;
102
+ }
103
+
104
+ .main {
105
+ padding: 30px 100px;
106
+ width: 960px;
107
+ margin: 0 auto;
108
+ }
109
+ .main h1 {
110
+ font-size: 36px;
111
+ color: #333;
112
+ text-align: left;
113
+ margin-bottom: 30px;
114
+ border-bottom: 1px solid #eee;
115
+ }
116
+
117
+ .helps {
118
+ margin-top: 40px;
119
+ }
120
+ .helps pre {
121
+ padding: 20px;
122
+ margin: 10px 0;
123
+ border: solid 1px #e7e1cd;
124
+ background-color: #fffdef;
125
+ overflow: auto;
126
+ }
127
+
128
+ .icon_lists {
129
+ width: 100% !important;
130
+ }
131
+
132
+ .icon_lists li {
133
+ float: left;
134
+ width: 100px;
135
+ height: 180px;
136
+ text-align: center;
137
+ list-style: none !important;
138
+ }
139
+ .icon_lists .icon {
140
+ font-size: 42px;
141
+ line-height: 100px;
142
+ margin: 10px 0;
143
+ color: #333;
144
+ -webkit-transition: font-size 0.25s ease-out 0s;
145
+ -moz-transition: font-size 0.25s ease-out 0s;
146
+ transition: font-size 0.25s ease-out 0s;
147
+ }
148
+ .icon_lists .icon:hover {
149
+ font-size: 100px;
150
+ }
151
+
152
+ .markdown {
153
+ color: #666;
154
+ font-size: 14px;
155
+ line-height: 1.8;
156
+ }
157
+
158
+ .highlight {
159
+ line-height: 1.5;
160
+ }
161
+
162
+ .markdown img {
163
+ vertical-align: middle;
164
+ max-width: 100%;
165
+ }
166
+
167
+ .markdown h1 {
168
+ color: #404040;
169
+ font-weight: 500;
170
+ line-height: 40px;
171
+ margin-bottom: 24px;
172
+ }
173
+
174
+ .markdown h2,
175
+ .markdown h3,
176
+ .markdown h4,
177
+ .markdown h5,
178
+ .markdown h6 {
179
+ color: #404040;
180
+ margin: 1.6em 0 0.6em 0;
181
+ font-weight: 500;
182
+ clear: both;
183
+ }
184
+
185
+ .markdown h1 {
186
+ font-size: 28px;
187
+ }
188
+
189
+ .markdown h2 {
190
+ font-size: 22px;
191
+ }
192
+
193
+ .markdown h3 {
194
+ font-size: 16px;
195
+ }
196
+
197
+ .markdown h4 {
198
+ font-size: 14px;
199
+ }
200
+
201
+ .markdown h5 {
202
+ font-size: 12px;
203
+ }
204
+
205
+ .markdown h6 {
206
+ font-size: 12px;
207
+ }
208
+
209
+ .markdown hr {
210
+ height: 1px;
211
+ border: 0;
212
+ background: #e9e9e9;
213
+ margin: 16px 0;
214
+ clear: both;
215
+ }
216
+
217
+ .markdown p,
218
+ .markdown pre {
219
+ margin: 1em 0;
220
+ }
221
+
222
+ .markdown > p,
223
+ .markdown > blockquote,
224
+ .markdown > .highlight,
225
+ .markdown > ol,
226
+ .markdown > ul {
227
+ width: 80%;
228
+ }
229
+
230
+ .markdown ul > li {
231
+ list-style: circle;
232
+ }
233
+
234
+ .markdown > ul li,
235
+ .markdown blockquote ul > li {
236
+ margin-left: 20px;
237
+ padding-left: 4px;
238
+ }
239
+
240
+ .markdown > ul li p,
241
+ .markdown > ol li p {
242
+ margin: 0.6em 0;
243
+ }
244
+
245
+ .markdown ol > li {
246
+ list-style: decimal;
247
+ }
248
+
249
+ .markdown > ol li,
250
+ .markdown blockquote ol > li {
251
+ margin-left: 20px;
252
+ padding-left: 4px;
253
+ }
254
+
255
+ .markdown code {
256
+ margin: 0 3px;
257
+ padding: 0 5px;
258
+ background: #eee;
259
+ border-radius: 3px;
260
+ }
261
+
262
+ .markdown pre {
263
+ border-radius: 6px;
264
+ background: #f7f7f7;
265
+ padding: 20px;
266
+ }
267
+
268
+ .markdown pre code {
269
+ border: none;
270
+ background: #f7f7f7;
271
+ margin: 0;
272
+ }
273
+
274
+ .markdown strong,
275
+ .markdown b {
276
+ font-weight: 600;
277
+ }
278
+
279
+ .markdown > table {
280
+ border-collapse: collapse;
281
+ border-spacing: 0px;
282
+ empty-cells: show;
283
+ border: 1px solid #e9e9e9;
284
+ width: 95%;
285
+ margin-bottom: 24px;
286
+ }
287
+
288
+ .markdown > table th {
289
+ white-space: nowrap;
290
+ color: #333;
291
+ font-weight: 600;
292
+ }
293
+
294
+ .markdown > table th,
295
+ .markdown > table td {
296
+ border: 1px solid #e9e9e9;
297
+ padding: 8px 16px;
298
+ text-align: left;
299
+ }
300
+
301
+ .markdown > table th {
302
+ background: #f7f7f7;
303
+ }
304
+
305
+ .markdown blockquote {
306
+ font-size: 90%;
307
+ color: #999;
308
+ border-left: 4px solid #e9e9e9;
309
+ padding-left: 0.8em;
310
+ margin: 1em 0;
311
+ font-style: italic;
312
+ }
313
+
314
+ .markdown blockquote p {
315
+ margin: 0;
316
+ }
317
+
318
+ .markdown .anchor {
319
+ opacity: 0;
320
+ transition: opacity 0.3s ease;
321
+ margin-left: 8px;
322
+ }
323
+
324
+ .markdown .waiting {
325
+ color: #ccc;
326
+ }
327
+
328
+ .markdown h1:hover .anchor,
329
+ .markdown h2:hover .anchor,
330
+ .markdown h3:hover .anchor,
331
+ .markdown h4:hover .anchor,
332
+ .markdown h5:hover .anchor,
333
+ .markdown h6:hover .anchor {
334
+ opacity: 1;
335
+ display: inline-block;
336
+ }
337
+
338
+ .markdown > br,
339
+ .markdown > p > br {
340
+ clear: both;
341
+ }
342
+
343
+ .hljs {
344
+ display: block;
345
+ background: white;
346
+ padding: 0.5em;
347
+ color: #333333;
348
+ overflow-x: auto;
349
+ }
350
+
351
+ .hljs-comment,
352
+ .hljs-meta {
353
+ color: #969896;
354
+ }
355
+
356
+ .hljs-string,
357
+ .hljs-variable,
358
+ .hljs-template-variable,
359
+ .hljs-strong,
360
+ .hljs-emphasis,
361
+ .hljs-quote {
362
+ color: #df5000;
363
+ }
364
+
365
+ .hljs-keyword,
366
+ .hljs-selector-tag,
367
+ .hljs-type {
368
+ color: #a71d5d;
369
+ }
370
+
371
+ .hljs-literal,
372
+ .hljs-symbol,
373
+ .hljs-bullet,
374
+ .hljs-attribute {
375
+ color: #0086b3;
376
+ }
377
+
378
+ .hljs-section,
379
+ .hljs-name {
380
+ color: #63a35c;
381
+ }
382
+
383
+ .hljs-tag {
384
+ color: #333333;
385
+ }
386
+
387
+ .hljs-title,
388
+ .hljs-attr,
389
+ .hljs-selector-id,
390
+ .hljs-selector-class,
391
+ .hljs-selector-attr,
392
+ .hljs-selector-pseudo {
393
+ color: #795da3;
394
+ }
395
+
396
+ .hljs-addition {
397
+ color: #55a532;
398
+ background-color: #eaffea;
399
+ }
400
+
401
+ .hljs-deletion {
402
+ color: #bd2c00;
403
+ background-color: #ffecec;
404
+ }
405
+
406
+ .hljs-link {
407
+ text-decoration: underline;
408
+ }
409
+
410
+ pre {
411
+ background: #fff;
412
+ }
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>IconFont</title>
6
+ <link rel="stylesheet" href="demo.css" />
7
+ <link rel="stylesheet" href="iconfont.css" />
8
+ </head>
9
+ <body>
10
+ <div class="main markdown">
11
+ <h1>IconFont 图标</h1>
12
+ <ul class="icon_lists clear">
13
+ <li>
14
+ <i class="icon iconfont icon-clock"></i>
15
+ <div class="name">clock</div>
16
+ <div class="fontclass">.icon-clock</div>
17
+ </li>
18
+ </ul>
19
+
20
+ <h2 id="font-class-">font-class引用</h2>
21
+ <hr />
22
+
23
+ <p>font-class是unicode使用方式的一种变种,主要是解决unicode书写不直观,语意不明确的问题。</p>
24
+ <p>与unicode使用方式相比,具有如下特点:</p>
25
+ <ul>
26
+ <li>兼容性良好,支持ie8+,及所有现代浏览器。</li>
27
+ <li>相比于unicode语意明确,书写更直观。可以很容易分辨这个icon是什么。</li>
28
+ <li>因为使用class来定义图标,所以当要替换图标时,只需要修改class里面的unicode引用。</li>
29
+ <li>不过因为本质上还是使用的字体,所以多色图标还是不支持的。</li>
30
+ </ul>
31
+ <p>使用步骤如下:</p>
32
+ <h3 id="-fontclass-">第一步:引入项目下面生成的fontclass代码:</h3>
33
+
34
+ <pre><code class="lang-js hljs javascript"><span class="hljs-comment">&lt;link rel="stylesheet" type="text/css" href="./iconfont.css"&gt;</span></code></pre>
35
+ <h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
36
+ <pre><code class="lang-css hljs">&lt;<span class="hljs-selector-tag">i</span> <span class="hljs-selector-tag">class</span>="<span class="hljs-selector-tag">iconfont</span> <span class="hljs-selector-tag">icon-xxx</span>"&gt;&lt;/<span class="hljs-selector-tag">i</span>&gt;</code></pre>
37
+ <blockquote>
38
+ <p>"iconfont"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。</p>
39
+ </blockquote>
40
+ </div>
41
+ </body>
42
+ </html>
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>IconFont</title>
6
+ <link rel="stylesheet" href="demo.css" />
7
+ <script src="iconfont.js"></script>
8
+
9
+ <style type="text/css">
10
+ .icon {
11
+ /* 通过设置 font-size 来改变图标大小 */
12
+ width: 1em;
13
+ height: 1em;
14
+ /* 图标和文字相邻时,垂直对齐 */
15
+ vertical-align: -0.15em;
16
+ /* 通过设置 color 来改变 SVG 的颜色/fill */
17
+ fill: currentColor;
18
+ /* path 和 stroke 溢出 viewBox 部分在 IE 下会显示
19
+ normalize.css 中也包含这行 */
20
+ overflow: hidden;
21
+ }
22
+ </style>
23
+ </head>
24
+ <body>
25
+ <div class="main markdown">
26
+ <h1>IconFont 图标</h1>
27
+ <ul class="icon_lists clear">
28
+ <li>
29
+ <svg class="icon" aria-hidden="true">
30
+ <use xlink:href="#icon-clock"></use>
31
+ </svg>
32
+ <div class="name">clock</div>
33
+ <div class="fontclass">#icon-clock</div>
34
+ </li>
35
+ </ul>
36
+
37
+ <h2 id="symbol-">symbol引用</h2>
38
+ <hr />
39
+
40
+ <p>
41
+ 这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
42
+ 这种用法其实是做了一个svg的集合,与另外两种相比具有如下特点:
43
+ </p>
44
+ <ul>
45
+ <li>支持多色图标了,不再受单色限制。</li>
46
+ <li>通过一些技巧,支持像字体那样,通过<code>font-size</code>,<code>color</code>来调整样式。</li>
47
+ <li>兼容性较差,支持 ie9+,及现代浏览器。</li>
48
+ <li>浏览器渲染svg的性能一般,还不如png。</li>
49
+ </ul>
50
+ <p>使用步骤如下:</p>
51
+ <h3 id="-symbol-">第一步:引入项目下面生成的symbol代码:</h3>
52
+ <pre><code class="lang-js hljs javascript"><span class="hljs-comment">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;</span></code></pre>
53
+ <h3 id="-css-">第二步:加入通用css代码(引入一次就行):</h3>
54
+ <pre><code class="lang-js hljs javascript">&lt;style type=<span class="hljs-string">"text/css"</span>&gt;
55
+ .icon {
56
+ width: <span class="hljs-number">1</span>em; height: <span class="hljs-number">1</span>em;
57
+ vertical-align: <span class="hljs-number">-0.15</span>em;
58
+ fill: currentColor;
59
+ overflow: hidden;
60
+ }
61
+ &lt;<span class="hljs-regexp">/style&gt;</span></code></pre>
62
+ <h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
63
+ <pre><code class="lang-js hljs javascript">&lt;svg <span class="hljs-class"><span class="hljs-keyword">class</span></span>=<span class="hljs-string">"icon"</span> aria-hidden=<span class="hljs-string">"true"</span>&gt;<span class="xml"><span class="hljs-tag">
64
+ &lt;<span class="hljs-name">use</span> <span class="hljs-attr">xlink:href</span>=<span class="hljs-string">"#icon-xxx"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">use</span>&gt;</span>
65
+ </span>&lt;<span class="hljs-regexp">/svg&gt;
66
+ </span></code></pre>
67
+ </div>
68
+ </body>
69
+ </html>
@@ -0,0 +1,77 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>IconFont</title>
6
+ <link rel="stylesheet" href="demo.css" />
7
+
8
+ <style type="text/css">
9
+ @font-face {
10
+ font-family: 'iconfont';
11
+ src: url('iconfont.eot'); /* IE9*/
12
+ src: url('iconfont.eot#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('iconfont.woff') format('woff'),
13
+ /* chrome, firefox */ url('iconfont.ttf') format('truetype'),
14
+ /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ url('iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
15
+ }
16
+
17
+ .iconfont {
18
+ font-family: 'iconfont' !important;
19
+ font-size: 16px;
20
+ font-style: normal;
21
+ -webkit-font-smoothing: antialiased;
22
+ -webkit-text-stroke-width: 0.2px;
23
+ -moz-osx-font-smoothing: grayscale;
24
+ }
25
+ </style>
26
+ </head>
27
+ <body>
28
+ <div class="main markdown">
29
+ <h1>IconFont 图标</h1>
30
+ <ul class="icon_lists clear">
31
+ <li>
32
+ <i class="icon iconfont">&#xe606;</i>
33
+ <div class="name">clock</div>
34
+ <div class="code">&amp;#xe606;</div>
35
+ </li>
36
+ </ul>
37
+ <h2 id="unicode-">unicode引用</h2>
38
+ <hr />
39
+
40
+ <p>unicode是字体在网页端最原始的应用方式,特点是:</p>
41
+ <ul>
42
+ <li>兼容性最好,支持ie6+,及所有现代浏览器。</li>
43
+ <li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
44
+ <li>但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。</li>
45
+ </ul>
46
+ <blockquote>
47
+ <p>注意:新版iconfont支持多色图标,这些多色图标在unicode模式下将不能使用,如果有需求建议使用symbol的引用方式</p>
48
+ </blockquote>
49
+ <p>unicode使用步骤如下:</p>
50
+ <h3 id="-font-face">第一步:拷贝项目下面生成的font-face</h3>
51
+ <pre><code class="lang-js hljs javascript">@font-face {
52
+ font-family: <span class="hljs-string">'iconfont'</span>;
53
+ src: url(<span class="hljs-string">'iconfont.eot'</span>);
54
+ src: url(<span class="hljs-string">'iconfont.eot?#iefix'</span>) format(<span class="hljs-string">'embedded-opentype'</span>),
55
+ url(<span class="hljs-string">'iconfont.woff'</span>) format(<span class="hljs-string">'woff'</span>),
56
+ url(<span class="hljs-string">'iconfont.ttf'</span>) format(<span class="hljs-string">'truetype'</span>),
57
+ url(<span class="hljs-string">'iconfont.svg#iconfont'</span>) format(<span class="hljs-string">'svg'</span>);
58
+ }
59
+ </code></pre>
60
+ <h3 id="-iconfont-">第二步:定义使用iconfont的样式</h3>
61
+ <pre><code class="lang-js hljs javascript">.iconfont{
62
+ font-family:<span class="hljs-string">"iconfont"</span> !important;
63
+ font-size:<span class="hljs-number">16</span>px;font-style:normal;
64
+ -webkit-font-smoothing: antialiased;
65
+ -webkit-text-stroke-width: <span class="hljs-number">0.2</span>px;
66
+ -moz-osx-font-smoothing: grayscale;
67
+ }
68
+ </code></pre>
69
+ <h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
70
+ <pre><code class="lang-js hljs javascript">&lt;i <span class="hljs-class"><span class="hljs-keyword">class</span></span>=<span class="hljs-string">"iconfont"</span>&gt;&amp;#x33;<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">i</span>&gt;</span></span></code></pre>
71
+
72
+ <blockquote>
73
+ <p>"iconfont"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。</p>
74
+ </blockquote>
75
+ </div>
76
+ </body>
77
+ </html>
@@ -0,0 +1,20 @@
1
+ @font-face {
2
+ font-family: "iconfont";
3
+ src: url("iconfont.eot?t=1502076641440"); /* IE9*/
4
+ src: url("iconfont.eot?t=1502076641440#iefix") format("embedded-opentype"),
5
+ /* IE6-IE8 */ url("iconfont.woff?t=1502076641440") format("woff"),
6
+ /* chrome, firefox */ url("iconfont.ttf?t=1502076641440") format("truetype"),
7
+ /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ url("iconfont.svg?t=1502076641440#iconfont") format("svg"); /* iOS 4.1- */
8
+ }
9
+
10
+ .iconfont {
11
+ font-family: "iconfont" !important;
12
+ font-size: 16px;
13
+ font-style: normal;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ }
17
+
18
+ .iconfont-clock:before {
19
+ content: "\e606";
20
+ }