Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
About HRT and TPM
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
luolonghao
May 24, 2013
Technology
80
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
About HRT and TPM
luolonghao
May 24, 2013
More Decks by luolonghao
See All by luolonghao
SeaJS TUI实践
luolonghao
0
98
KindEditor 设计思路 V2
luolonghao
1
180
Other Decks in Technology
See All in Technology
Digitization部 紹介資料
sansan33
PRO
2
7.7k
巨大気象データと戦う ― サロゲートモデル学習を高速化する圧縮技術
gpuunite_official
0
140
AIのためのEthernet技術動向 (SerDes)
markunet
1
240
生成 AI の基礎 〜 サンプル実装で学ぶ基本原理
enakai00
7
4.5k
DDDのエッセンスを取り入れたAIでの開発
ak2ie
0
170
Bits AI を制するものは Datadog を制す / The player that controls Bits AI, controls Datadog
kaminashi
0
140
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
170
AIで変わるエンジニアの働き方(仮)
naoinaoi
0
200
Master Dataグループ紹介資料
sansan33
PRO
1
4.8k
属人化を叩き割れ!「制作加速」と「安定化」の矛盾を打破する:8年目プロダクトが辿り着いた「ミスが起こり得ない」アセット制作フローの全貌
gree_tech
PRO
0
120
FDEの心得
noriakioji
5
6.4k
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
9.3k
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
260
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
950
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Music & Morning Musume
bryan
47
7.3k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
490
The Art of Programming - Codeland 2020
erikaheidi
57
14k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Transcript
About HRT, TPM 2013.05.22
HRT 前端调试工具,把任何HTTP URL指向到本地文件或其它URL。
HRT安装 1. 安装Node.js最新版 2. 在命令行执行npm install hrt -g
HRT启动 1. 修改浏览器代理设置,IP:127.0.0.1,端口:2222。推荐 用SwitchySharp(Chrome插件)、FoxyProxy(Firefox插件) 切换代理。 2. 在命令行输入hrt hrt-config.js,启动HTTP服务。如果用v3 目录下的配置文件,直接双击v3/hrt-server-2222.cmd即 可。
其它选项: 1. 指定HTTP端口:hrt --port=3333 2. 查看所有请求:hrt --debug=true
跳转规则(hrt-config.js) exports.map = [ // 代理文件 ['http://js.tudouui.com/v3/dist/js/g.js', 'D:\\static\\v3\\src\\js\\g.js’], // 代理目录
['http://js.tudouui.com/v3/dist/js', 'D:\\static\\v3\\src\\js‘], // 指向到其它URL ['http://js.tudouui.com/v3/dist/js', 'http://jstest.tudouui.com/v3/dist/js‘], ];
预处理(hrt-config.js) exports.before = function(url) { // 移除版本号 return url.replace(/([^?]+)_\d+(\.(?:js|css))/, '$1$2');
}; // 返回undefined时,跳过此URL。 exports.before = function(url) { // Bugfix:Chrome的LESS调试插件请求less文件,所以less文件不能跳转 if (/\.less$/.test(url)) { return; } };
控制返回内容(hrt-config.js) exports.merge = function(path, callback) { // 所有JS头部添加注释 if (/\.js$/.test(path))
{ var content = Util.readFileSync(path, 'utf-8'); return callback('application/javascript', '/* test /*\n' + content); } // 其它请求 var contentType = require('mime').lookup(path); var buffer = this.util.readFileSync(path); return callback(contentType, buffer); };
插件(plugins/tudou.js) exports.before = function(url) { var Tudou = this.util.loadPlugin('tudou'); //
移除版本号 url = Tudou.stripVersionInfo(url); return url; }; 函数列表: 1. Tudou.stripVersionInfo(url):移除版本号 2. Tudou.cssToLess(url) :CSS扩展名改成LESS 3. Tudou.merge(path, callback):合并TUI3本地文件 4. Tudou.mergeTui2(path, callback):合并TUI2本地文件
TPM 前端构建工具,包含打包、压缩、列表、发布等功能。
TPM安装 1. 安装Node.js最新版 2. 在命令行执行npm install tpm -g
构建文件(打包、压缩) $ ytpm [PATH] PATH可指定文件或目录,CSS和JS只构建 v3/tpm-config.js里配好的入口文件。
构建文件(打包、压缩) # 构建JS $ ytpm src/js/g.js $ ytpm src/js/page #
构建LESS $ ytpm src/css/g.less $ ytpm src/css/page # 复制图片、HTML $ ytpm src/img/g/v2.png $ ytpm src/embed # 批量构建 $ ytpm project/TUILIB-65.txt
构建文件(打包、压缩) $ c: $ ytpm d:\static\v3\src\js\g.js $ d: $ cd
static\v3\src\js $ ytpm g.js
压缩代码 $ ytpm min [PATH] $ ytpm min build/js/g.js $
ytpm min build/js/page $ ytpm min build/css/g.css $ ytpm min build/css/page
获取文件列表 $ ytpm list [REVISION] 打开新建邮件窗口,列出指定版本之后新增/ 修改过的文件和最新版本号。 $ ytpm list
29885 $ ytpm list [PATH] 打开新建邮件窗口,列出project文件里的文 件和最新版本号。 $ ytpm list project/TUILIB-65.txt
发布文件 $ ytpm deploy [PATH][ENV] 通过FTP或SSH将指定文件发布到指定服务器。 PATH为静态文件路径或project路径,ENV目前 只支持beta。 $ ytpm
deploy dist/js/g.js beta $ ytpm deploy dist/js beta $ ytpm deploy project/TUILIB-65.txt beta
TPM配置(tpm-config.js) root:项目根目录 jira_host:JIRA URL deploy_mail:发布邮件,TO地址 ignore:全局模块列表,打包非全局JS时忽略这 些模块。 main:JS、LESS入口文件 libjs:全局非AMD文件,合并JS后放在src目录下 globaljs:全局JS列表
ftp:FTP配置 ssh:SSH配置
Github 1. HRT: https://github.com/tudouui/hrt 2. TPM:https://github.com/tudouui/tpm