YSlow for PhantomJS で指定可能となっているthreshouldがよく分からなかったので調べてみた
- 抜粋
$ phantomjs yslow.js --help
YSlow Options:
-t, --threshold <score> for test formats, the threshold to test scores ([0-100]|[A-F]|{JSON}) [80]
e.g.: -t B or -t 75 or -t '{"overall": "B", "ycdn": "F", "yexpires": 85}'
threshold
指定方法
- -t の後にスコアを0-100かA-F(ケース非依存)で指定、もしくはJSONを記述する
- JSONで記述する場合は項目別にスコアを指定することができる
- JSONで描かない場合は全項目に同じスコアが指定されることになる
-t B
-t 75
-t '{"overall": "B", "ycdn": "F", "yexpires": 85}'
JSONで指定可能な項目
項目 | 説明 |
---|---|
overall | the common threshold |
ynumreq | Make fewer HTTP requests |
ycdn | Use a Content Delivery Network (CDN) |
yemptysrc | Avoid empty src or href |
yexpires | Add Expires headers |
ycompress | Compress components with gzip |
ycsstop | Put CSS at top |
yjsbottom | Put JavaScript at bottom |
yexpressions | Avoid CSS expressions |
yexternal | Make JavaScript and CSS external |
ydns | Reduce DNS lookups |
yminify | Minify JavaScript and CSS |
yredirects | Avoid URL redirects |
ydupes | Remove duplicate JavaScript and CSS |
yetags | Configure entity tags (ETags) |
yxhr | Make AJAX cacheable |
yxhrmethod | Use GET for AJAX requests |
ymindom | Reduce the number of DOM elements |
yno404 | Avoid HTTP 404 (Not Found) error |
ymincookie | Reduce cookie size |
ycookiefree | Use cookie-free domains |
ynofilter | Avoid AlphaImageLoader filter |
yimgnoscale | Do not scale images in HTML |
yfavicon | Make favicon small and cacheable |
- yslow.js -i all を実行すると全ての結果が表示されるので、それでどのような項目を評価しているか分かります
- スコアを指定しない項目には overall で指定した値またはディフォルト(80)がセットされます
- -t B と -t '{"overall":"B"}' は同じ意味となります