作者leondemon (狗狗)
看板Web_Design
標題[問題] Web開發最佳實踐?
時間Mon Oct 3 14:13:57 2016
想問問 Best Practice 的問題
開發的時候,往往會有分 Production 和 Staging/Development 版本
例如:
1. HTML 中,使用的 Library在 Production 可能用 CDN 的 .min.js
但 Development 可能是用 Local 的 source code
2. JS 中可能有些參數是給 Staging/Development 用的,不希望曝光在 Production 中
3. CSS/SASS/LESS 等,依照環境,是否壓縮最佳化
因此想問問看 Web 開發的最佳實踐,是如何切出 Production/Staging/Development 代碼
我的想法是,資料夾如下 (舉個例子)
root/ --- src/ --- index.prod.html
| |- index.dev.html
| |- JS/ --- app.js (import settings.js)
| |- settings.prod.js
| |- settings.dev.js
|
|- dist/ --- index.html
|- JS/ --- app.js
|- settings.js
利用類似 gulp 或其他工具,將 src/ 底下相關的資源,打包到 dist/ 底下
然後如果選擇打包 dev 環境,就會把 *.dev.* 打包為 *.* (去掉 .dev )
不知道開發時,最佳實踐是什麼呢?有沒有現有的工具做到這件事?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.120.104.45
※ 文章網址: https://www.ptt.cc/bbs/Web_Design/M.1475475239.A.D31.html
※ 編輯: leondemon (123.120.104.45), 10/03/2016 14:18:04
推 Kenqr: 推一下 我也想知道 10/03 14:22
推 GoalBased: 你說到gulp就可以了吧 10/03 14:36
推 Gold740716: git branch? 10/03 21:16