前端優化
- Server 設置:啟用 gzip 壓縮、靜態內容設置 max-age/expires 或使用 CDN、動態內容設置 cache control。(樣板參考)
- 減少 HTTP Requests:善用 CSS Sprite 解決大量載入圖片的問題,盡量以水平排列圖片,相較於垂直排列圖片大小較小。
- favicon.ico:存在且小於 1KB 加上較長的 expires。
- 預載:頁面加載完成後隨即加載用於其他頁面的資源。
CORS
| apiVersion: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: maintenance-page | |
| data: | |
| maintenance.html: |- | |
| <!--HTML GOES HERE--> | |
| <!doctype html> | |
| <title>Site Maintenance</title> | |
| <link rel="stylesheet" href="maintenance.css"> |
前端優化
CORS
| //http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
| Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
| #!/bin/bash | |
| ### BEGIN INIT INFO | |
| # Provides: myapp passenger in standalone | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # X-Interactive: true | |
| # Short-Description: Start/stop myapp.com web site | |
| ### END INIT INFO | |
| #PATH=/sbin:/usr/sbin:/bin:/usr/bin |
| #!/bin/bash | |
| # works with a file called VERSION in the current directory, | |
| # the contents of which should be a semantic version number | |
| # such as "1.2.3" | |
| # this script will display the current version, automatically | |
| # suggest a "minor" version update, and ask for input to use | |
| # the suggestion, or a newly entered value. |