-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
269 lines (168 loc) · 13.6 KB
/
index.html
File metadata and controls
269 lines (168 loc) · 13.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>likoshow-blog</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta property="og:type" content="website">
<meta property="og:title" content="likoshow-blog">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="likoshow-blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="likoshow-blog">
<link rel="alternate" href="/atom.xml" title="likoshow-blog" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="banner"></div>
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="/" id="logo">likoshow-blog</a>
</h1>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<a class="main-nav-link" href="/">Home</a>
<a class="main-nav-link" href="/archives">Archives</a>
</nav>
<nav id="sub-nav">
<a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
<a id="nav-search-btn" class="nav-icon" title="Search"></a>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit"></button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main">
<article id="中文-直播项目总结" class="article article-type-中文" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2017/08/19/直播项目总结/" class="article-date">
<time datetime="2017-08-19T03:08:27.000Z" itemprop="datePublished">2017-08-19</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2017/08/19/直播项目总结/">直播项目总结</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h2 id="js的模块化和打包"><a href="#js的模块化和打包" class="headerlink" title="js的模块化和打包"></a>js的模块化和打包</h2><p>因为之前在公司做的项目都是维护性的项目,所以不需要也必要进行技术选型。于是,之前我所写的js都是基于seajs方案的。<br>这次的直播项目,我决定换个方案。首先这个是独立的项目,所以可以不用考虑很多兼容问题,然后seajs并不好用,而且已经不再维护了。<br>于是,开始的时候,我选择了使用commonjs的模块化方案,使用wepack来打包代码。<br>后来发现 webpack 新版可以支持一定的 treeshaking ,不过需要使用 es6 的esm方案,就赶紧改写了所有的代码。<br>使用之后,发现果然美滋滋。<br>因为你只要按照es6+来写代码就好了,源代码里面再不会出现 exports 等不符合规范的东西了(需要配置 babel )。</p>
<h3 id="项目中出现的问题有:"><a href="#项目中出现的问题有:" class="headerlink" title="项目中出现的问题有:"></a>项目中出现的问题有:</h3><ol>
<li><p>当增加一个模块时,别的模块的打包结果会发生变化<br> 后来发现是 webpack 在打包中使用数字来表示源模块,通过修改 config ,<br> 换成使用路径就解决了这个问题。</p>
</li>
<li><p>webpack 运行一次需要很长时间<br> 发现可以使用 watch ,这样每次只打包你修改过的那个模块,速度就快很多了</p>
</li>
</ol>
<h2 id="css-打包"><a href="#css-打包" class="headerlink" title="css 打包"></a>css 打包</h2><p>css方面,依然是使用了scss来做预处理,毕竟在项目中为了节省时间,使用了一些之前的代码。所以使用了同样的方案。<br>因为有一些页面不需要打包js,所以不方便使用 webpack 来打包。于是使用了 gulp-sass,替换了之前的koala。<br>而且,搭配着使用了 gulp-base64,来减少网络请求,提高性能。同时切图的时候也方便了不少,很多小图标可以独立切图了,不用再手工拼接了。</p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2017/08/19/直播项目总结/" data-id="cj6iq6h590002ksgd9bin66jv" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-中文输入法下input截断错误" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2017/07/03/中文输入法下input截断错误/" class="article-date">
<time datetime="2017-07-03T04:14:02.000Z" itemprop="datePublished">2017-07-03</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2017/07/03/中文输入法下input截断错误/">中文输入法下input截断错误</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h2 id="问题描述:"><a href="#问题描述:" class="headerlink" title="问题描述:"></a>问题描述:</h2><pre><code>在中文输入法下面,当在input中输入中文时,如果遇到超过字数被截断的时候,输入的并不是中文,而是字母。 可以同时绑定 compositionstart 和 compositionend 事件来判断是否在使用输入法。 当正在使用输入法的时候,暂停截断;输入法使用结束的时候,重新触发事件。
</code></pre><h2 id="参考代码:"><a href="#参考代码:" class="headerlink" title="参考代码:"></a>参考代码:</h2><figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">let</span> isIME = <span class="literal">false</span>;</div><div class="line"><span class="keyword">const</span> $input = $(<span class="string">'#text'</span>);</div><div class="line">$input.on(<span class="string">'input change'</span>, () => {</div><div class="line"> <span class="keyword">if</span>(isIME) <span class="keyword">return</span>; <span class="comment">// 中文输入过程中不截断</span></div><div class="line"> <span class="keyword">var</span> value = $input.val();</div><div class="line"> <span class="built_in">console</span>.log(<span class="string">'当前输入:'</span> + value);</div><div class="line"> <span class="keyword">if</span>(Str.byteLen(value, <span class="number">3</span>)><span class="number">24</span>){</div><div class="line"> $(<span class="keyword">this</span>).val(Str.getMaxlen(value, <span class="number">24</span>));</div><div class="line"> }</div><div class="line">}).on(<span class="string">'compositionstart'</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>{</div><div class="line"> isIME = <span class="literal">true</span>;</div><div class="line"> <span class="built_in">console</span>.log(<span class="string">'中文输入:开始'</span>);</div><div class="line">}).on(<span class="string">'compositionend'</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>{</div><div class="line"> isIME = <span class="literal">false</span>;</div><div class="line"> $input.trigger(<span class="string">'change'</span>);</div><div class="line"> <span class="built_in">console</span>.log(<span class="string">'中文输入:结束'</span>);</div><div class="line">});</div></pre></td></tr></table></figure>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2017/07/03/中文输入法下input截断错误/" data-id="cj6iq6h510000ksgdbj803fk0" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-hello-world" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2017/07/03/hello-world/" class="article-date">
<time datetime="2017-07-03T03:49:15.935Z" itemprop="datePublished">2017-07-03</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2017/07/03/hello-world/">Hello World</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="external">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="external">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="external">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo new <span class="string">"My New Post"</span></div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="external">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo server</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="external">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo generate</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="external">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo deploy</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2017/07/03/hello-world/" data-id="cj6iq6h560001ksgdd2r096jc" class="article-share-link">Share</a>
</footer>
</div>
</article>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">Archives</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/08/">August 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/07/">July 2017</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Recent Posts</h3>
<div class="widget">
<ul>
<li>
<a href="/2017/08/19/直播项目总结/">直播项目总结</a>
</li>
<li>
<a href="/2017/07/03/中文输入法下input截断错误/">中文输入法下input截断错误</a>
</li>
<li>
<a href="/2017/07/03/hello-world/">Hello World</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2017 John Doe<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/" class="mobile-nav-link">Home</a>
<a href="/archives" class="mobile-nav-link">Archives</a>
</nav>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script src="/js/script.js"></script>
</div>
</body>
</html>