kn-cli 1.0.63 → 1.0.65

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 (130) hide show
  1. package/package.json +2 -1
  2. package/readme.md +6 -0
  3. package/src/create.js +2 -0
  4. package/templates/template_oa/public/src/components/IFrame/index.jsx +3 -0
  5. package/templates/template_oa/readme.md +6 -1
  6. package/templates/template_oa/webpack.api.js +7 -3
  7. package/templates/template_oa_jwt/.gitignore +6 -0
  8. package/templates/template_oa_jwt/build.sh +7 -0
  9. package/templates/template_oa_jwt/cli.config.js +30 -0
  10. package/templates/template_oa_jwt/dev.sh +89 -0
  11. package/templates/template_oa_jwt/frontend_build.sh +88 -0
  12. package/templates/template_oa_jwt/init/prepare-commit-msg +5 -0
  13. package/templates/template_oa_jwt/init.sh +33 -0
  14. package/templates/template_oa_jwt/jsconfig.json +10 -0
  15. package/templates/template_oa_jwt/package.json +25 -0
  16. package/templates/template_oa_jwt/public/404.html +26 -0
  17. package/templates/template_oa_jwt/public/favicon.ico +0 -0
  18. package/templates/template_oa_jwt/public/index.html +44 -0
  19. package/templates/template_oa_jwt/public/src/_antd.less +216 -0
  20. package/templates/template_oa_jwt/public/src/_reset.less +134 -0
  21. package/templates/template_oa_jwt/public/src/_variable.less +84 -0
  22. package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.eot +0 -0
  23. package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.less +57 -0
  24. package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.svg +36 -0
  25. package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.ttf +0 -0
  26. package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.woff +0 -0
  27. package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.woff2 +0 -0
  28. package/templates/template_oa_jwt/public/src/assets/images/NY-pop-bg.png +0 -0
  29. package/templates/template_oa_jwt/public/src/assets/images/avatar.png +0 -0
  30. package/templates/template_oa_jwt/public/src/assets/images/loading.svg +40 -0
  31. package/templates/template_oa_jwt/public/src/components/Alert/index.jsx +0 -0
  32. package/templates/template_oa_jwt/public/src/components/Alert/index.less +0 -0
  33. package/templates/template_oa_jwt/public/src/components/Auth/index.jsx +44 -0
  34. package/templates/template_oa_jwt/public/src/components/Dialog/index.jsx +150 -0
  35. package/templates/template_oa_jwt/public/src/components/Dialog/index.less +123 -0
  36. package/templates/template_oa_jwt/public/src/components/Empty/index.jsx +23 -0
  37. package/templates/template_oa_jwt/public/src/components/Empty/index.less +6 -0
  38. package/templates/template_oa_jwt/public/src/components/Footer/index.jsx +17 -0
  39. package/templates/template_oa_jwt/public/src/components/Footer/index.less +28 -0
  40. package/templates/template_oa_jwt/public/src/components/FormRow/index.jsx +39 -0
  41. package/templates/template_oa_jwt/public/src/components/FormRow/index.less +67 -0
  42. package/templates/template_oa_jwt/public/src/components/FormTable/index.jsx +137 -0
  43. package/templates/template_oa_jwt/public/src/components/FormTable/index.less +18 -0
  44. package/templates/template_oa_jwt/public/src/components/IFrame/index.jsx +44 -0
  45. package/templates/template_oa_jwt/public/src/components/IFrame/index.less +4 -0
  46. package/templates/template_oa_jwt/public/src/components/IconFont/index.jsx +10 -0
  47. package/templates/template_oa_jwt/public/src/components/IconFont/index.less +5 -0
  48. package/templates/template_oa_jwt/public/src/components/Layout/Basic/index.jsx +52 -0
  49. package/templates/template_oa_jwt/public/src/components/Layout/Basic/index.less +82 -0
  50. package/templates/template_oa_jwt/public/src/components/Layout/CenterBody/index.jsx +15 -0
  51. package/templates/template_oa_jwt/public/src/components/Layout/CenterBody/index.less +36 -0
  52. package/templates/template_oa_jwt/public/src/components/Layout/FormBlock/index.jsx +23 -0
  53. package/templates/template_oa_jwt/public/src/components/Layout/FormBlock/index.less +37 -0
  54. package/templates/template_oa_jwt/public/src/components/Layout/Provider/index.jsx +12 -0
  55. package/templates/template_oa_jwt/public/src/components/Layout/index.jsx +27 -0
  56. package/templates/template_oa_jwt/public/src/components/Layout/index.less +8 -0
  57. package/templates/template_oa_jwt/public/src/components/Link/index.jsx +24 -0
  58. package/templates/template_oa_jwt/public/src/components/Link/index.less +11 -0
  59. package/templates/template_oa_jwt/public/src/components/Loading/index.jsx +16 -0
  60. package/templates/template_oa_jwt/public/src/components/Loading/index.less +96 -0
  61. package/templates/template_oa_jwt/public/src/components/Nav/index.jsx +184 -0
  62. package/templates/template_oa_jwt/public/src/components/Nav/index.less +38 -0
  63. package/templates/template_oa_jwt/public/src/components/Page/PageLoading/index.jsx +30 -0
  64. package/templates/template_oa_jwt/public/src/components/Page/PageLoading/index.less +29 -0
  65. package/templates/template_oa_jwt/public/src/components/Popup/index.jsx +22 -0
  66. package/templates/template_oa_jwt/public/src/components/Popup/index.less +18 -0
  67. package/templates/template_oa_jwt/public/src/components/Select/DepSelect/index.jsx +47 -0
  68. package/templates/template_oa_jwt/public/src/components/Select/StaffSelect/index.jsx +97 -0
  69. package/templates/template_oa_jwt/public/src/components/Select/StaffSelect/index.less +24 -0
  70. package/templates/template_oa_jwt/public/src/components/Toast/index.jsx +60 -0
  71. package/templates/template_oa_jwt/public/src/components/Toast/index.less +43 -0
  72. package/templates/template_oa_jwt/public/src/components/Upload/index.jsx +358 -0
  73. package/templates/template_oa_jwt/public/src/components/title/index.jsx +12 -0
  74. package/templates/template_oa_jwt/public/src/components/title/index.less +21 -0
  75. package/templates/template_oa_jwt/public/src/dictionary/index.js +20 -0
  76. package/templates/template_oa_jwt/public/src/hooks/index.jsx +21 -0
  77. package/templates/template_oa_jwt/public/src/hooks/useDelay.jsx +29 -0
  78. package/templates/template_oa_jwt/public/src/hooks/useImageLoader.jsx +27 -0
  79. package/templates/template_oa_jwt/public/src/hooks/useLoading.jsx +42 -0
  80. package/templates/template_oa_jwt/public/src/hooks/useLogin.jsx +33 -0
  81. package/templates/template_oa_jwt/public/src/hooks/usePreload.jsx +66 -0
  82. package/templates/template_oa_jwt/public/src/hooks/useScrollTop.jsx +32 -0
  83. package/templates/template_oa_jwt/public/src/hooks/useSearch.jsx +137 -0
  84. package/templates/template_oa_jwt/public/src/hooks/useUpdate.jsx +11 -0
  85. package/templates/template_oa_jwt/public/src/index.jsx +50 -0
  86. package/templates/template_oa_jwt/public/src/mock/common.js +484 -0
  87. package/templates/template_oa_jwt/public/src/mock/index.js +63 -0
  88. package/templates/template_oa_jwt/public/src/mock/user.js +70 -0
  89. package/templates/template_oa_jwt/public/src/mock/utils.js +33 -0
  90. package/templates/template_oa_jwt/public/src/pages/components/pageTitle/index.jsx +13 -0
  91. package/templates/template_oa_jwt/public/src/pages/components/pageTitle/index.less +20 -0
  92. package/templates/template_oa_jwt/public/src/pages/components/totalRecord/index.jsx +21 -0
  93. package/templates/template_oa_jwt/public/src/pages/components/totalRecord/index.less +16 -0
  94. package/templates/template_oa_jwt/public/src/pages/demo/detail/index.jsx +14 -0
  95. package/templates/template_oa_jwt/public/src/pages/demo/index.jsx +399 -0
  96. package/templates/template_oa_jwt/public/src/pages/demo/index.less +15 -0
  97. package/templates/template_oa_jwt/public/src/pages/login/index.jsx +29 -0
  98. package/templates/template_oa_jwt/public/src/pages/login/index.less +44 -0
  99. package/templates/template_oa_jwt/public/src/pages/redirect/index.jsx +31 -0
  100. package/templates/template_oa_jwt/public/src/provider/app.jsx +66 -0
  101. package/templates/template_oa_jwt/public/src/route.jsx +45 -0
  102. package/templates/template_oa_jwt/public/src/services/common.js +133 -0
  103. package/templates/template_oa_jwt/public/src/services/demo.js +41 -0
  104. package/templates/template_oa_jwt/public/src/services/index.js +266 -0
  105. package/templates/template_oa_jwt/public/src/services/token.js +132 -0
  106. package/templates/template_oa_jwt/public/src/utils/index.js +115 -0
  107. package/templates/template_oa_jwt/public/static/about.html +1 -0
  108. package/templates/template_oa_jwt/public/static/kssoLogin.html +22 -0
  109. package/templates/template_oa_jwt/public/static/noAuth.html +217 -0
  110. package/templates/template_oa_jwt/public/static/noAuth.png +0 -0
  111. package/templates/template_oa_jwt/readme.md +71 -0
  112. package/templates/template_oa_jwt/report.sh +68 -0
  113. package/templates/template_oa_jwt/tools/iconfont/gulpfile.js +70 -0
  114. package/templates/template_oa_jwt/tools/iconfont/package.json +20 -0
  115. package/templates/template_oa_jwt/tools/iconfont/run.sh +39 -0
  116. package/templates/template_oa_jwt/tools/iconfont/svg/arrowBack.svg +1 -0
  117. package/templates/template_oa_jwt/tools/iconfont/svg/check.svg +1 -0
  118. package/templates/template_oa_jwt/tools/iconfont/svg/close.svg +1 -0
  119. package/templates/template_oa_jwt/tools/iconfont/svg/down.svg +1 -0
  120. package/templates/template_oa_jwt/tools/iconfont/svg/image.svg +1 -0
  121. package/templates/template_oa_jwt/tools/iconfont/svg/play.svg +1 -0
  122. package/templates/template_oa_jwt/tools/iconfont/svg/refresh.svg +1 -0
  123. package/templates/template_oa_jwt/tools/iconfont/svg/warn.svg +1 -0
  124. package/templates/template_oa_jwt/tools/iconfont/templates/_icons.css +26 -0
  125. package/templates/template_oa_jwt/tools/iconfont/templates/_icons.less +29 -0
  126. package/templates/template_oa_jwt/tools/iconfont/templates/index.html +56 -0
  127. package/templates/template_oa_jwt/tools/tinypng/package.json +11 -0
  128. package/templates/template_oa_jwt/tools/tinypng/run.sh +15 -0
  129. package/templates/template_oa_jwt/versionPublish.sh +27 -0
  130. package/templates/template_oa_jwt/webpack.api.js +61 -0
@@ -0,0 +1,217 @@
1
+ <!doctype html>
2
+ <html lang="zh">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7
+ <meta content="telephone=no" name="format-detection" />
8
+ <meta content="yes" name="apple-mobile-web-app-capable" />
9
+ <meta content="black" name="apple-mobile-web-app-status-bar-style">
10
+
11
+ <meta name="viewport"
12
+ content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no,viewport-fit=cover" />
13
+ <title>无权限</title>
14
+ <style>
15
+ * {
16
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
17
+ position: relative;
18
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
19
+ -webkit-text-size-adjust: none;
20
+ -ms-box-sizing: border-box;
21
+ box-sizing: border-box;
22
+
23
+ margin: 0;
24
+ padding: 0;
25
+ border: 0;
26
+ border-spacing: 0;
27
+ outline: none;
28
+ -webkit-touch-callout: none;
29
+ }
30
+
31
+ html {
32
+ font-size: 14px;
33
+ }
34
+
35
+ html,
36
+ body {
37
+ width: 100%;
38
+ height: 100%;
39
+ background-color: #f6f6f6;
40
+ }
41
+
42
+ body {
43
+ height: 100%;
44
+ display: -webkit-box;
45
+ display: flex;
46
+ -webkit-box-pack: center;
47
+ justify-content: center;
48
+ -webkit-box-align: center;
49
+ /* align-items: center; */
50
+ }
51
+
52
+ p {
53
+ font-size: .26rem;
54
+ color: #ccc;
55
+ }
56
+
57
+ .loading {
58
+ width: 1.08rem;
59
+ position: absolute;
60
+ left: 0;
61
+ right: 0;
62
+ bottom: 0;
63
+ top: 0;
64
+ margin: auto;
65
+ display: none;
66
+ }
67
+
68
+ span {
69
+ font-size: .14rem;
70
+ }
71
+
72
+
73
+ #express {
74
+ width: 100%;
75
+ height: 100%;
76
+ padding: .16rem .24rem;
77
+ background-color: #fff;
78
+ }
79
+
80
+ #express[data-show='false'] {
81
+ display: none;
82
+ }
83
+
84
+ #express header {
85
+ font-size: .16rem;
86
+ font-weight: 500;
87
+ color: #1D2129;
88
+ line-height: .24rem;
89
+ margin-bottom: .16rem;
90
+ }
91
+
92
+
93
+ #express .menuBox {
94
+ display: -ms-grid;
95
+ display: grid;
96
+ grid-template-columns: repeat(auto-fit, minmax(1.56rem, 1fr));
97
+ height: 1.14rem;
98
+ grid-gap: .15rem;
99
+ width: 100%;
100
+ }
101
+
102
+ .menuItem {
103
+ display: -webkit-box;
104
+ display: flex;
105
+ -webkit-box-orient: vertical;
106
+ -webkit-box-direction: normal;
107
+ flex-direction: column;
108
+ -webkit-box-pack: justify;
109
+ justify-content: space-between;
110
+ padding: .16rem;
111
+ height: 100%;
112
+ }
113
+
114
+ .menuItem[data-color='orange'] {
115
+ background: url(./images/texture2.png) 100% no-repeat, -webkit-linear-gradient(#FFF3E8, #FFFBF7);
116
+ background: url(./images/texture2.png) 100% no-repeat, linear-gradient(#FFF3E8, #FFFBF7);
117
+ }
118
+
119
+ .menuItem[data-color='blue'] {
120
+ background: url(./images/texture2.png) 100% no-repeat, -webkit-linear-gradient(#E8F7FF, #F5FBFF);
121
+ background: url(./images/texture2.png) 100% no-repeat, linear-gradient(#E8F7FF, #F5FBFF);
122
+ }
123
+
124
+ .menuItem[data-color='pink'] {
125
+ background: url(./images/texture2.png) 100% no-repeat, -webkit-linear-gradient(#FFE8F1, #FFF7FA);
126
+ background: url(./images/texture2.png) 100% no-repeat, linear-gradient(#FFE8F1, #FFF7FA);
127
+ }
128
+
129
+ .menuItem[data-color='purple'] {
130
+ background: url(./images/texture2.png) 100% no-repeat, -webkit-linear-gradient(#F5E8FF, #FBF5FF);
131
+ background: url(./images/texture2.png) 100% no-repeat, linear-gradient(#F5E8FF, #FBF5FF);
132
+ }
133
+
134
+ .menuItem[data-color='grey'] {
135
+ background: url(./images/texture2.png) 100% no-repeat, -webkit-linear-gradient(#F0F5FA, #F7F9FA);
136
+ background: url(./images/texture2.png) 100% no-repeat, linear-gradient(#F0F5FA, #F7F9FA);
137
+ }
138
+
139
+ .menuItem img {
140
+ width: .48rem;
141
+ height: .48rem;
142
+ pointer-events: none;
143
+ }
144
+
145
+ .menuItem span {
146
+ font-size: .14rem;
147
+ line-height: .22rem;
148
+ font-weight: 500;
149
+ color: #1D2129;
150
+ pointer-events: none;
151
+ margin-top: .11rem;
152
+ }
153
+
154
+ #noAuth {
155
+ display: flex;
156
+ flex-direction: column;
157
+ justify-content: center;
158
+ align-items: center;
159
+ width: 100%;
160
+ height: 100%;
161
+ position: absolute;
162
+ left: 0;
163
+ top: 0;
164
+ background-color: white;
165
+ }
166
+
167
+ #noAuth[data-show='false'] {
168
+ display: none;
169
+ }
170
+
171
+ #noAuth img {
172
+ width: .96rem;
173
+ margin-bottom: .08rem;
174
+ }
175
+
176
+ #noAuth span {
177
+ font-size: .14rem;
178
+ font-weight: 400;
179
+ color: #86909C;
180
+ line-height: .22rem;
181
+ }
182
+ </style>
183
+ </head>
184
+
185
+ <body>
186
+ <section id="noAuth" data-show="true">
187
+ <img src="./noAuth.png" />
188
+ <span>您暂无该功能权限哦!</span>
189
+ <span>如有需要,请联系管理员添加</span>
190
+ </section>
191
+
192
+ <script>
193
+ var docEl = document.documentElement;
194
+ function setRemUnit(type) {
195
+ let w = Math.max(window.innerWidth, docEl.clientWidth, docEl.offsetWidth);
196
+ let defaultWidth = 375;//填入设计稿上的宽度
197
+ w = w > defaultWidth ? defaultWidth : w;
198
+ var rem = w / defaultWidth * 100;
199
+ console.log('scale: ' + rem)
200
+ docEl.style.fontSize = rem + 'px'
201
+ }
202
+ setRemUnit('init');
203
+ if (document.readyState === 'interactive') {
204
+ setRemUnit('init');
205
+ } else {
206
+ window.addEventListener('DOMContentLoaded', function () {
207
+ setRemUnit('init');
208
+ })
209
+ }
210
+ window.addEventListener("resize", function () {
211
+ setRemUnit('resize');
212
+ });
213
+ </script>
214
+
215
+ </body>
216
+
217
+ </html>
@@ -0,0 +1,71 @@
1
+ # OA管理系统-KSSO权限版
2
+
3
+ ### 初始化项目
4
+ 克隆到本地,完毕后,执行`sh init.sh`
5
+
6
+ ### 本地调试
7
+ 1. `sh dev.sh`
8
+ 2
9
+
10
+
11
+ ### 生产环境部署
12
+ 1. 向运维申请CICD环境,申请模板如下:
13
+ ```
14
+ 标题:应用申请
15
+
16
+ 内容:
17
+ 应用名称: 自定义名称
18
+ 域名:自定义域名
19
+ 用途:说明文本
20
+
21
+ 仓库地址:项目仓库地址
22
+ 环境要求:node 16.18.0
23
+ 构建方式:执行仓库下 sh frontend_build.sh
24
+ 部署方式:将构建完成的文件夹下的 `release` 内的内容部署到目标服务器
25
+ 参考应用:oa-app
26
+ 其它要求:nginx添加对index.html的缓存策略,配置如下:
27
+ expires 0;
28
+ add_header Cache-Control "max-age=0";
29
+ add_header Cache-Control "private";
30
+ add_header Cache-Control "no-store";
31
+ add_header Cache-Control "no-cache";
32
+ add_header Cache-Control "must-revalidate";
33
+ add_header Cache-Control "proxy-revalidate";
34
+
35
+ ```
36
+ 2. 进入CICD,构建相应环境
37
+ 3. 快速发布
38
+ 4. 进入域名访问
39
+
40
+ > 注意需要在测试和生产环境的OA系统内 增加本站域名的跨域支持
41
+
42
+
43
+ ### 版本发布Tag
44
+ 执行 `sh versionPublish.sh` 给正式发布的版本打tag里程碑,便于查看及回滚
45
+
46
+
47
+ ### 目录介绍
48
+
49
+ * static: 不参与打包,会在打包后将整个文件夹复制到站点根目录下
50
+ * src: 所有源码放在这个下面
51
+ * assets: 站点内用到的静态资源文件
52
+ * components: 通用性组件
53
+ * dictionary: 字典
54
+ * hooks: 所用的hooks
55
+ * mock: 接口mock配置
56
+ * pages: 所有页面源代码
57
+ * pageName: 每个页面自己名称的文件夹
58
+ * components: 页面自己的组件
59
+ * components: 跨页面使用的组件
60
+ * provider: 全局的provider通信组件
61
+ * services: 所有接口服务
62
+ * utils: 全局通用的工具类
63
+ * _variable.less: 全局通用less变量
64
+ * _reset.less: 站点初始化less配置
65
+ * index.jsx: 站点入口
66
+ * route.jsx: 站点路由配置
67
+ * pluginjs: 第三方静态引入的js库
68
+ * tools: 构建工具
69
+ * iconfont: 构建Iconfont工具
70
+ * tinypng: 压缩png工具
71
+
@@ -0,0 +1,68 @@
1
+ if [ -d "${HOME}/.nvm/" ]
2
+ then
3
+ . ${HOME}/.nvm/nvm.sh
4
+ fi
5
+
6
+ node_version="v16.18.0"
7
+
8
+ checkNode(){
9
+ for line in `node -v`
10
+ do
11
+ if [ $line != $node_version ]
12
+ then
13
+ echo "change Node from $line to $node_version"
14
+ nvm use $node_version
15
+ ret=$?
16
+ if [ $ret != 0 ]
17
+ then
18
+ echo "Please run nvm install $node_version"
19
+ exit 3
20
+ else
21
+ return 0
22
+ fi
23
+ else
24
+ return 0
25
+ fi
26
+ done
27
+ }
28
+
29
+ checkResult(){
30
+ ret=$?
31
+ if [ $ret != 0 ]
32
+ then
33
+ echo "[$1]执行失败"
34
+ exit 2
35
+ return 0
36
+ else
37
+ echo "[$1]执行成功"
38
+ return 0
39
+ fi
40
+ }
41
+
42
+
43
+ checkKnCli(){
44
+ if ! [ -x "$(command -v kn-cli)" ]
45
+ then
46
+ npm i kn-cli -g
47
+ return 0
48
+ fi
49
+ return 0
50
+ }
51
+
52
+
53
+ build(){
54
+ npm config delete registry -g
55
+ npm config delete registry
56
+
57
+ checkKnCli
58
+ checkResult "检查kn-cli"
59
+
60
+ kn-cli --report
61
+ checkResult "kn-cli --report"
62
+ }
63
+
64
+ checkNode
65
+ checkResult "检查node"
66
+
67
+ build
68
+ checkResult "build"
@@ -0,0 +1,70 @@
1
+ var gulp = require('gulp');
2
+ const $ = require('gulp-load-plugins')();
3
+ var fs=require('fs');
4
+
5
+
6
+ var srcPath ='.'
7
+
8
+ /*****************************************
9
+ * svg转iconfont 替代iconfont.com的方案
10
+ *****************************************/
11
+ function clean_iconfont(cb){
12
+ return gulp.src(`${srcPath}/dist`,{read:false,allowEmpty:true})
13
+ .pipe($.clean());
14
+ }
15
+ function iconfontLess(cb){
16
+ var fontName = 'iconfont';
17
+ return gulp.src(`${srcPath}/svg/*.svg`)
18
+ .pipe($.iconfontCss({
19
+ fontName: fontName,
20
+ path: `${srcPath}/templates/_icons.less`,
21
+ targetPath: 'iconfont.less',
22
+ fontPath: '~@/assets/iconfont/'
23
+ }))
24
+ .pipe($.iconfont({
25
+ fontName: fontName,
26
+ formats: ['svg', 'ttf', 'eot', 'woff', 'woff2'],
27
+ normalize: true
28
+ }))
29
+ .pipe(gulp.dest(`${srcPath}/dist/less/`));
30
+ }
31
+
32
+ function iconfontCss(cb){
33
+ var fontName = 'iconfont';
34
+ return gulp.src(`${srcPath}/svg/*.svg`)
35
+ .pipe($.iconfontCss({
36
+ fontName: fontName,
37
+ path: `${srcPath}/templates/_icons.css`,
38
+ targetPath: 'iconfont.css',
39
+ fontPath: `${srcPath}/`
40
+ }))
41
+ .pipe($.iconfont({
42
+ fontName: fontName,
43
+ formats: ['svg', 'ttf', 'eot', 'woff', 'woff2'],
44
+ normalize: true
45
+ }))
46
+ .pipe(gulp.dest(`${srcPath}/dist/css/`));
47
+ }
48
+
49
+
50
+ function iconfontExample(cb){
51
+
52
+ var files = fs.readdirSync(`${srcPath}/svg/`);
53
+
54
+ let icons=[]
55
+ files.forEach(function(file){
56
+ console.log(file);
57
+ if(/\.svg$/.test(file)){
58
+ icons.push(file.replace(/\.\w+$/, ''))
59
+ }
60
+ });
61
+
62
+ return gulp.src(`${srcPath}/templates/index.html`)
63
+ .pipe($.template({icons: icons}))
64
+ .pipe(gulp.dest(`${srcPath}/dist/css/`));
65
+ }
66
+
67
+
68
+ exports.iconfont = gulp.series(clean_iconfont,iconfontLess,iconfontCss,iconfontExample);
69
+ // exports.iconfontCss = gulp.series(clean_iconfont,iconfontCss,iconfontExample);
70
+
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "iconfont",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "license": "MIT",
6
+ "node": "10.15.0",
7
+ "dependencies": {
8
+ "colors": "^1.4.0",
9
+ "gulp": "^4.0.2",
10
+ "gulp-load-plugins": "^2.0.1",
11
+ "gulp-clean": "^0.4.0",
12
+ "gulp-iconfont": "^11.0.1",
13
+ "gulp-iconfont-css": "^3.0.0",
14
+ "gulp-template": "^5.0.0",
15
+ "lazypipe": "^1.0.2",
16
+ "svgfont2svgicons": "^2.0.0",
17
+ "svgicons2svgfont": "^12.0.0"
18
+ },
19
+ "devDependencies": {}
20
+ }
@@ -0,0 +1,39 @@
1
+ if [ -d "${HOME}/.nvm/" ]
2
+ then
3
+ . ${HOME}/.nvm/nvm.sh
4
+ fi
5
+
6
+
7
+ checkNode(){
8
+ for line in `node -v`
9
+ do
10
+ if [ $line != "v10.15.0" ]
11
+ then
12
+ nvm use v10.15.0
13
+ ret=$?
14
+ if [ $ret != 0 ]
15
+ then
16
+ echo -e "\033[41;37m Change Node to v10.15.0 (try nvm use v10.15.0)\033[0m"
17
+ return 0
18
+ else
19
+ return 1
20
+ fi
21
+ else
22
+ return 1
23
+ fi
24
+ done
25
+ }
26
+
27
+
28
+ run(){
29
+ npm i
30
+ node_modules/.bin/gulp iconfont
31
+ echo '生成完毕,请前往 dist 查看结果'
32
+ }
33
+
34
+ checkNode
35
+ ret=$?
36
+ if [ $ret = 1 ]
37
+ then
38
+ run
39
+ fi
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1655695159864" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7044" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M319.64 512.016l336.016-336.008 45.248 45.248L364.896 557.28z" p-id="7045"></path><path d="M365.216 466.464l339.976 339.968-45.256 45.256-339.976-339.976z" p-id="7046"></path></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="128px" height="128.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#2c2c2c" d="M411.062857 698.514286c16.164571 22.674286 49.883429 22.674286 66.121143 0l269.604571-373.76a10.24 10.24 0 0 0-8.338285-16.310857h-60.050286a40.740571 40.740571 0 0 0-33.133714 17.042285l-201.142857 279.04-91.062858-126.464a40.96 40.96 0 0 0-33.206857-16.969143h-59.977143a10.24 10.24 0 0 0-8.338285 16.237715l159.451428 221.184z" /><path fill="#2c2c2c" d="M983.04 0H40.96A40.96 40.96 0 0 0 0 40.96v942.08c0 22.674286 18.285714 40.96 40.96 40.96h942.08c22.674286 0 40.96-18.285714 40.96-40.96V40.96a40.96 40.96 0 0 0-40.96-40.96z m-51.2 931.84H92.16V92.16h839.68v839.68z" /></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="128px" height="128.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#2c2c2c" d="M596.52729 512.000427L1020.889603 20.56617c7.082661-8.191993 1.109332-20.565316-9.898659-20.565317h-129.023892a26.709311 26.709311 0 0 0-19.88265 8.959993L512.04736 414.293841 161.924985 8.960846A26.197312 26.197312 0 0 0 142.042335 0.000853H13.018443c-11.093324 0-17.066652 12.373323-9.898659 20.565317L427.652764 512.000427 3.119784 1003.434684c-7.082661 8.191993-1.109332 20.565316 9.898659 20.565316h129.023892c7.679994 0 14.847988-3.327997 19.88265-8.959993L512.04736 609.707012l350.122375 405.332995a26.197312 26.197312 0 0 0 19.88265 8.959993h129.023892c11.093324 0 17.066652-12.373323 9.898659-20.565316L596.441956 512.000427z" /></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="128px" height="85.39px" viewBox="0 0 1535 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#2c2c2c" d="M1519.737123 0H1368.198572c-10.239091 0-19.966228 5.119546-26.109682 13.18283L767.931846 796.345324 193.774802 13.18283A32.509115 32.509115 0 0 0 167.793108 0H16.254557C3.071727 0-4.607591 14.846682 3.071727 25.341751L715.456503 997.543468a64.890241 64.890241 0 0 0 104.56672 0L1532.663976 25.341751a15.870591 15.870591 0 0 0-12.798864-25.341751z" /></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="128px" height="96.02px" viewBox="0 0 1365 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#2c2c2c" d="M1316.578377 0.011093H48.638906A47.614929 47.614929 0 0 0 0 46.516713v930.96572c0 25.684755 21.75951 46.50562 48.724237 46.505621H1316.663708a47.614929 47.614929 0 0 0 48.724237-46.505621V46.516713A47.614929 47.614929 0 0 0 1316.578377 0.011093z m-61.011961 919.275316H109.736198v-58.025361l211.024585-239.013289 228.688188 258.895509 355.831994-402.593609 350.285451 396.535078v44.201672z m0-188.838417l-340.984327-386.039315a12.458386 12.458386 0 0 0-18.602249 0L549.534302 736.591853l-219.472395-248.314413a12.458386 12.458386 0 0 0-18.602248 0L109.736198 716.624303v-611.826234h1145.830218V730.447992z" /><path fill="#2c2c2c" d="M365.730438 430.508074c74.067667 0 134.05565-57.257378 134.05565-127.99712 0-70.65441-59.987984-127.99712-134.05565-127.997121s-134.140982 57.34271-134.140982 127.997121c0 70.739742 60.073315 127.99712 134.140982 127.99712z m0-168.700205c23.636802 0 42.665707 18.175591 42.665706 40.703085a41.64173 41.64173 0 0 1-42.665706 40.788415 41.64173 41.64173 0 0 1-42.665707-40.788415c0-22.527493 19.028905-40.703084 42.665707-40.703085z" /></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="128px" height="128.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#2c2c2c" d="M422.765714 723.968l255.268572-200.557714c7.314286-5.778286 7.314286-16.822857 0-22.674286L422.765714 300.032a14.482286 14.482286 0 0 0-23.405714 11.264v401.261714c0 12.068571 13.897143 18.797714 23.405714 11.410286z" /><path fill="#2c2c2c" d="M983.04 0H40.96A40.96 40.96 0 0 0 0 40.96v942.08c0 22.674286 18.285714 40.96 40.96 40.96h942.08c22.674286 0 40.96-18.285714 40.96-40.96V40.96a40.96 40.96 0 0 0-40.96-40.96z m-51.2 931.84H92.16V92.16h839.68v839.68z" /></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1656403559957" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2942" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M684.032 403.456q-17.408-8.192-15.872-22.016t11.776-22.016q3.072-2.048 19.968-15.872t41.472-33.28q-43.008-49.152-102.4-77.312t-129.024-28.16q-64.512 0-120.832 24.064t-98.304 66.048-66.048 98.304-24.064 120.832q0 63.488 24.064 119.808t66.048 98.304 98.304 66.048 120.832 24.064q53.248 0 100.864-16.896t87.04-47.616 67.584-72.192 41.472-90.624q7.168-23.552 26.624-38.912t46.08-15.36q31.744 0 53.76 22.528t22.016 53.248q0 14.336-5.12 27.648-21.504 71.68-63.488 132.096t-99.84 103.936-128.512 68.096-148.48 24.576q-95.232 0-179.2-35.84t-145.92-98.304-98.304-145.92-36.352-178.688 36.352-179.2 98.304-145.92 145.92-98.304 179.2-36.352q105.472 0 195.584 43.52t153.6 118.272q23.552-17.408 39.424-30.208t19.968-15.872q6.144-5.12 13.312-7.68t13.312 0 10.752 10.752 6.656 24.576q1.024 9.216 2.048 31.232t2.048 51.2 1.024 60.416-1.024 58.88q-1.024 34.816-16.384 50.176-8.192 8.192-24.576 9.216t-34.816-3.072q-27.648-6.144-60.928-13.312t-63.488-14.848-53.248-14.336-29.184-9.728z" p-id="2943"></path></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1656311332811" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2256" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m0 819.2a51.2 51.2 0 1 1 51.2-51.2 51.2 51.2 0 0 1-51.2 51.2z m51.2-153.6H460.8V204.8h102.4z" p-id="2257"></path></svg>
@@ -0,0 +1,26 @@
1
+ @font-face {
2
+ font-family: "<%= fontName %>";
3
+ src: url('<%= fontPath %><%= fontName %>.eot');
4
+ src: url('<%= fontPath %><%= fontName %>.eot?#iefix') format('eot'),
5
+ url('<%= fontPath %><%= fontName %>.woff') format('woff'),
6
+ url('<%= fontPath %><%= fontName %>.ttf') format('truetype'),
7
+ url('<%= fontPath %><%= fontName %>.svg#<%= fontName %>') format('svg');
8
+ }
9
+
10
+ .iconfont:before {
11
+ font-family: "<%= fontName %>";
12
+ -webkit-font-smoothing: antialiased;
13
+ -moz-osx-font-smoothing: grayscale;
14
+ font-style: normal;
15
+ font-variant: normal;
16
+ font-weight: normal;
17
+ /* speak: none; only necessary if not using the private unicode range (firstGlyph option) */
18
+ text-decoration: none;
19
+ text-transform: none;
20
+ }
21
+
22
+ <% _.each(glyphs, function(glyph) { %>
23
+ .icon-<%= glyph.fileName %>:before {
24
+ content: "\<%= glyph.codePoint %>";
25
+ }
26
+ <% }); %>
@@ -0,0 +1,29 @@
1
+ :global{
2
+ @font-face {
3
+ font-family: "<%= fontName %>";
4
+ src: url('<%= fontPath %><%= fontName %>.eot');
5
+ src: url('<%= fontPath %><%= fontName %>.eot?#iefix') format('eot'),
6
+ url('<%= fontPath %><%= fontName %>.woff') format('woff'),
7
+ url('<%= fontPath %><%= fontName %>.ttf') format('truetype'),
8
+ url('<%= fontPath %><%= fontName %>.svg#<%= fontName %>') format('svg');
9
+ }
10
+
11
+ .iconfont:before {
12
+ font-family: "<%= fontName %>";
13
+ -webkit-font-smoothing: antialiased;
14
+ -moz-osx-font-smoothing: grayscale;
15
+ font-style: normal;
16
+ font-variant: normal;
17
+ font-weight: normal;
18
+ /* speak: none; only necessary if not using the private unicode range (firstGlyph option) */
19
+ text-decoration: none;
20
+ text-transform: none;
21
+ }
22
+
23
+ <% _.each(glyphs, function(glyph) { %>
24
+ .icon-<%= glyph.fileName %>:before {
25
+ content: "\<%= glyph.codePoint %>";
26
+ }
27
+ <% }); %>
28
+
29
+ }
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title>icon font test</title>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <link rel="stylesheet" href="./iconfont.css">
9
+ <style>
10
+ .icon_lists{
11
+ display: flex;
12
+ flex-wrap: wrap;
13
+ }
14
+ .icon_lists li{
15
+ /* float:left; */
16
+ /* display: flex; */
17
+ min-width: 100px;
18
+ height:150px;
19
+ text-align: center;
20
+ list-style: none;
21
+ }
22
+ .icon_lists .iconfont{
23
+ font-size: 42px;
24
+ margin: 10px;
25
+ color:#333;
26
+ -webkit-transition: font-size 0.25s ease-out 0s;
27
+ -moz-transition: font-size 0.25s ease-out 0s;
28
+ transition: font-size 0.25s ease-out 0s;
29
+
30
+ }
31
+ .icon_lists .iconfont:hover{
32
+ font-size: 100px;
33
+ }
34
+ .name {
35
+ font-size: 16px;
36
+ }
37
+ </style>
38
+ </head>
39
+
40
+ <body>
41
+ <h2>Icon Font</h2>
42
+ <ul class="icon_lists clear">
43
+ <% _.each(icons, function(icon,idx) { %>
44
+ <li class="iconfont icon-<%= icon %>">
45
+ <div class="name"><%= idx%>:<%= icon%></div>
46
+ </li>
47
+ <% }); %>
48
+ </ul>
49
+ <div>
50
+ <h2>使用方法</h2>
51
+ <pre>
52
+ &lt;span class=&quot;iconfont icon-iconName>&quot;&gt;&lt;/span&gt;
53
+ </pre>
54
+ </div>
55
+ </body>
56
+ </html>
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "tinypng",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "license": "MIT",
6
+ "node": "10.15.0",
7
+ "dependencies": {
8
+ "super-tinypng": "^1.0.5"
9
+ },
10
+ "devDependencies": {}
11
+ }
@@ -0,0 +1,15 @@
1
+ if [ -d "${HOME}/.nvm/" ]
2
+ then
3
+ . ${HOME}/.nvm/nvm.sh
4
+ fi
5
+
6
+ echo "开始压缩 ./img/ 下的所有png图片"
7
+
8
+ nvm use v10.15.0
9
+ npm config delete registry -g
10
+ npm config delete registry
11
+ npm i
12
+ cd img
13
+ ../node_modules/.bin/super-tinypng
14
+
15
+ echo "压缩完毕"