2019-04-09

2019-04-09

[2019-04-28]使用html-webpack-plugin@3.2处理html时, 如果模板当中使用类似${}ES6字符串模板时, 会导致报错
[2019-04-24]git pull时避免merge之后自动提交
[2019-04-12]ios app最大内存限制
[2019-04-09]git仓库迁移

[2019-04-28]使用html-webpack-plugin@3.2处理html时, 如果模板当中使用类似${}ES6字符串模板时, 会导致报错

如果html模板当中使用类似${}ES6字符串模板, 回到报错

ERROR in Template execution failed: ReferenceError: xxxx is not defined

ERROR in   ReferenceError: xxxx is not defined

这是因为html-webpack-plugin中有指定的html loader解析出现问题, 同样的, 要解决这个问题, 指定一个新的loader就可以了

这个问题已经在html-webpack-plugin4.0版本中修复, 所以如果不想升级html-webpack-plugin的话, 可以直接copy4.0版本中的loader

详情可以看这个html-webpack-plugin#1023

先把loader复制下来, 然后把html-webpack-plugin的配置修改成下面的即可

{
  template: '!!' + require.resolve('./loader') + '!' + template
}
[2019-04-24]git pull时避免merge之后自动提交

在使用git pull来拉远程分支的代码时, 如果远程分支与本地分支不一致, 但又没导致冲突时, git实际上会帮我们自动执行merge操作生成一个’merge commit’并进行commit

如果想避免merge commit的话, 一个方法是使用git pull --rebase, 但使用rebase实际上是会改写提交记录的, 一般情况下应该尽量避免在公共分支上做rebase操作.

而有些场景提交公共分支上又希望尽量保持本地分支的commit是最新的(而不是被merge commit之后), 就如一些发布系统是读取当前HEAD上的commit(commit msg上会有发布信息), 去做发布操作.

而如果merge commit生成之后再去改写commit msg的话又略显复杂, 这个时候除了rebase还能这样做

  • 使用git pull –no-commit
git pull --no-commit

# git add . # 这里可能需要解决冲突

git commit 'pub' # 带上版本发布信息
[2019-04-12]ios app最大内存限制

来源: stackoverflow/ios-app-maximum-memory-budget

对相关测试过程不太了解, 下面数据完全复制stackoverflow的答案, 仅供参考

iPad1: 127MB/256MB/49%
iPad2: 275MB/512MB/53%
iPad3: 645MB/1024MB/62%
iPad4: 585MB/1024MB/57% (iOS 8.1)
iPad Mini 1st Generation: 297MB/512MB/58%
iPad Mini retina: 696MB/1024MB/68% (iOS 7.1)
iPad Air: 697MB/1024MB/68%
iPad Air 2: 1383MB/2048MB/68% (iOS 10.2.1)
iPad Pro 9.7": 1395MB/1971MB/71% (iOS 10.0.2 (14A456))
iPad Pro 10.5”: 3057/4000/76% (iOS 11 beta4)
iPad Pro 12.9” (2015): 3058/3999/76% (iOS 11.2.1)
iPad Pro 12.9” (2017): 3057/3974/77% (iOS 11 beta4)
iPad Pro 11.0” (2018): 2858/3769/76% (iOS 12.1)
iPad Pro 12.9” (2018, 1TB): 4598/5650/81% (iOS 12.1)
iPod touch 4th gen: 130MB/256MB/51% (iOS 6.1.1)
iPod touch 5th gen: 286MB/512MB/56% (iOS 7.0)
iPhone4: 325MB/512MB/63%
iPhone4s: 286MB/512MB/56%
iPhone5: 645MB/1024MB/62%
iPhone5s: 646MB/1024MB/63%
iPhone6: 645MB/1024MB/62% (iOS 8.x)
iPhone6+: 645MB/1024MB/62% (iOS 8.x)
iPhone6s: 1396MB/2048MB/68% (iOS 9.2)
iPhone6s+: 1392MB/2048MB/68% (iOS 10.2.1)
iPhoneSE: 1395MB/2048MB/69% (iOS 9.3)
iPhone7: 1395/2048MB/68% (iOS 10.2)
iPhone7+: 2040MB/3072MB/66% (iOS 10.2.1)
iPhone8: 1364/1990MB/70% (iOS 12.1)
iPhone X: 1392/2785/50% (iOS 11.2.1)
iPhone XS: 2040/3754/54% (iOS 12.1)
iPhone XS Max: 2039/3735/55% (iOS 12.1)
iPhone XR: 1792/2813/63% (iOS 12.1)
[2019-04-09]git仓库迁移

摘录自 https://segmentfault.com/a/1190000012821833

# 设置远程仓库地址
git remote set-url origin remote_git_address

# 推送到远程
git push origin --all # 推送所有分支

git push --tags # 推送标签