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
luolonghao
May 24, 2013
Technology
76
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
97
KindEditor 设计思路 V2
luolonghao
1
180
Other Decks in Technology
See All in Technology
Android の公式 Skill / Android skills
yanzm
0
140
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
240
あなたの知らないPDFのアクセシビリティ
lycorptech_jp
PRO
0
190
あなたの AI ワークスペースに、 専門コーダーを連れてくる - Amazon Quick Desktop 最新情報
kawaji_scratch
1
140
NAB Show 2026 動画技術関連レポート / NAB Show 2026 Report
cyberagentdevelopers
PRO
0
200
RAG を使わないという選択肢
tatsutaka
1
230
自律型AIエージェントは何を破壊するのか
kojira
0
160
How Timee Delivers Day 1 Production Ready LLM Features
tomoyks
0
220
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
990
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.3k
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
750
フィジカル版Github Onshapeの紹介
shiba_8ro
0
210
Featured
See All Featured
So, you think you're a good person
axbom
PRO
2
2.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
BBQ
matthewcrist
89
10k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2k
Discover your Explorer Soul
emna__ayadi
2
1.1k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
150
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Thoughts on Productivity
jonyablonski
76
5.2k
Everyday Curiosity
cassininazir
0
230
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
470
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
430
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