Compare commits
628 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b60046431 | ||
|
|
07ee69683c | ||
|
|
19c8065b6a | ||
|
|
6f5ed6f921 | ||
|
|
6415ccd9b0 | ||
|
|
39a1801a88 | ||
|
|
dfca687243 | ||
|
|
42f16dfaa1 | ||
|
|
a36b296b89 | ||
|
|
68197bc42d | ||
|
|
adecc5da03 | ||
|
|
fac03ef28f | ||
|
|
38c7a90cbf | ||
|
|
7b0ba6b083 | ||
|
|
28f922ff3c | ||
|
|
445037ccf4 | ||
|
|
920e52a5d4 | ||
|
|
456211dc54 | ||
|
|
e52927a03e | ||
|
|
596d9a9dcc | ||
|
|
50b46d6fa2 | ||
|
|
1d96e32876 | ||
|
|
8e90c33cef | ||
|
|
66b137083f | ||
|
|
02bdaea124 | ||
|
|
5ed4dadf5c | ||
|
|
1c30c5a660 | ||
|
|
d590b0efe9 | ||
|
|
f23340ed9b | ||
|
|
3ce6e98cde | ||
|
|
703d0b8651 | ||
|
|
1e3be1842b | ||
|
|
cc265d4511 | ||
|
|
889e377b2d | ||
|
|
d3969484ff | ||
|
|
5370479476 | ||
|
|
83f4f28186 | ||
|
|
288f9922c0 | ||
|
|
2a60c6b3d1 | ||
|
|
49089be067 | ||
|
|
ca30a53977 | ||
|
|
7aa306c0b3 | ||
|
|
0c52750ea6 | ||
|
|
cbde32f684 | ||
|
|
4505fa12b1 | ||
|
|
5a2585f42c | ||
|
|
d2d5fd1eac | ||
|
|
d242bd27cd | ||
|
|
7a2f9dcf8b | ||
|
|
6bfd7948c6 | ||
|
|
3942ee1775 | ||
|
|
e53c1df9cf | ||
|
|
d055e4e6c1 | ||
|
|
4934c5defd | ||
|
|
b2b24c351e | ||
|
|
c20eb1a6fa | ||
|
|
09dc03ae17 | ||
|
|
6e1417b857 | ||
|
|
509648b8a5 | ||
|
|
e1e53cf83c | ||
|
|
1ab8d64169 | ||
|
|
e49353b05f | ||
|
|
a95f300ac8 | ||
|
|
1d320b59a3 | ||
|
|
eb2dc2fe90 | ||
|
|
1b581aff02 | ||
|
|
c264d91c6c | ||
|
|
02bf76cd16 | ||
|
|
3606c8345f | ||
|
|
cfae00adab | ||
|
|
5469e272a4 | ||
|
|
21e77285e2 | ||
|
|
b0db5d5eb6 | ||
|
|
060ac246fd | ||
|
|
339b6c96ad | ||
|
|
086280e6fd | ||
|
|
ce64453057 | ||
|
|
00ee25c1be | ||
|
|
6c1c1db5a2 | ||
|
|
263af0b468 | ||
|
|
4026f03249 | ||
|
|
258cbef93c | ||
|
|
9cb7e46f32 | ||
|
|
863de294e8 | ||
|
|
7912513084 | ||
|
|
1c55518def | ||
|
|
9cf989542c | ||
|
|
9ced71e8ef | ||
|
|
e2fff6fe07 | ||
|
|
923b0f3adc | ||
|
|
767dc09916 | ||
|
|
efe88dfbf2 | ||
|
|
1ec581885a | ||
|
|
aa0396eae7 | ||
|
|
758eab9f35 | ||
|
|
c448cc03e7 | ||
|
|
db1574059d | ||
|
|
ca4bf4793d | ||
|
|
1aad336ef7 | ||
|
|
1929462a39 | ||
|
|
5bbd604930 | ||
|
|
b0ddd13910 | ||
|
|
fe6c2f56ec | ||
|
|
f8f347e392 | ||
|
|
080026e4f4 | ||
|
|
9434b5bc79 | ||
|
|
f9ebf5d2e9 | ||
|
|
c93f45ff38 | ||
|
|
5dbb3b4b0a | ||
|
|
deeb952314 | ||
|
|
0659528100 | ||
|
|
4d65006439 | ||
|
|
ab117fc461 | ||
|
|
5d2a6dbe3a | ||
|
|
a2240384c7 | ||
|
|
cedd640083 | ||
|
|
ac50fbc1e2 | ||
|
|
f96fed6942 | ||
|
|
f2924da1b1 | ||
|
|
a111a79500 | ||
|
|
ce0c28932b | ||
|
|
d7e668235f | ||
|
|
8552d9543e | ||
|
|
af3bd79de5 | ||
|
|
2dcdaf0104 | ||
|
|
3cebea1671 | ||
|
|
a5e31d6132 | ||
|
|
37470f8da6 | ||
|
|
e1b81302bd | ||
|
|
965f3f1636 | ||
|
|
fddbaa3487 | ||
|
|
26d6be2479 | ||
|
|
611162c891 | ||
|
|
f5d13045c0 | ||
|
|
cff92881a8 | ||
|
|
2eb19a9c99 | ||
|
|
2b5f881ecc | ||
|
|
6a304122b7 | ||
|
|
8b1f5ebe50 | ||
|
|
4b213f9050 | ||
|
|
0bf9143cd1 | ||
|
|
d269a55d45 | ||
|
|
c04b0b57b5 | ||
|
|
f6ccd1032d | ||
|
|
af98e6fc51 | ||
|
|
f0358b52a5 | ||
|
|
1dd911f06a | ||
|
|
1738287ce9 | ||
|
|
5c02f406e4 | ||
|
|
2dc1493df6 | ||
|
|
79beb6c91c | ||
|
|
26ea01971c | ||
|
|
4932b4070f | ||
|
|
27d1fda0dc | ||
|
|
e80a3e0637 | ||
|
|
a36d558702 | ||
|
|
3e0b0de9da | ||
|
|
ce9c57c105 | ||
|
|
f4cd5c18a3 | ||
|
|
0f9507774b | ||
|
|
01296493e7 | ||
|
|
8c4ce42af3 | ||
|
|
3719f56c86 | ||
|
|
b3755703b7 | ||
|
|
f6830c199b | ||
|
|
f93c8e1636 | ||
|
|
5884c3a5fd | ||
|
|
d5c0d33d10 | ||
|
|
b780098073 | ||
|
|
2e1a7bf567 | ||
|
|
481dfc1966 | ||
|
|
71d5229611 | ||
|
|
32aabb23f7 | ||
|
|
fd52982efd | ||
|
|
9feb29f465 | ||
|
|
23bd766955 | ||
|
|
024600fd57 | ||
|
|
e2ca1bf931 | ||
|
|
2b5eeeef27 | ||
|
|
e97689d7aa | ||
|
|
791734033f | ||
|
|
cafea9f090 | ||
|
|
d582fe5d8e | ||
|
|
a835a4dbb0 | ||
|
|
ba7d47f931 | ||
|
|
b1e3aa5fe4 | ||
|
|
a8e96a79a1 | ||
|
|
d8e28f2f2e | ||
|
|
2727fa23a6 | ||
|
|
fdb58e6815 | ||
|
|
875df4e9b5 | ||
|
|
a0cf284836 | ||
|
|
a7b1a71624 | ||
|
|
f40da1b529 | ||
|
|
9efe695f4d | ||
|
|
05965584fc | ||
|
|
2dd8ad97f8 | ||
|
|
78533f248c | ||
|
|
8bf92b0989 | ||
|
|
8074f1584f | ||
|
|
6122ef5ab1 | ||
|
|
212afb9d43 | ||
|
|
8278b4552d | ||
|
|
ce11ab3f8e | ||
|
|
8b634157e3 | ||
|
|
588e82c8dc | ||
|
|
07634ccaf1 | ||
|
|
1c18e9e8ca | ||
|
|
821f3449aa | ||
|
|
4a69c41694 | ||
|
|
6290f4018c | ||
|
|
5718718cdd | ||
|
|
d526c488ea | ||
|
|
e0b5b1c93d | ||
|
|
0eb2dc932a | ||
|
|
fb6d9387ed | ||
|
|
b0fd587b26 | ||
|
|
5347f874ed | ||
|
|
d32dfb7a48 | ||
|
|
380c4f80d8 | ||
|
|
125a7a6840 | ||
|
|
1437e0fefd | ||
|
|
0a80ebafd0 | ||
|
|
5fdb99f91b | ||
|
|
b72f114d95 | ||
|
|
90734c0b45 | ||
|
|
f022785b64 | ||
|
|
d20c503e08 | ||
|
|
a37f57addb | ||
|
|
a87078d406 | ||
|
|
ecdb8d79ac | ||
|
|
f3cc3a28e4 | ||
|
|
8d50ceb127 | ||
|
|
f1e9bb3f94 | ||
|
|
5e213a872c | ||
|
|
638f77206f | ||
|
|
25fa9bedd7 | ||
|
|
b230b84043 | ||
|
|
362eb87946 | ||
|
|
eaf87bb500 | ||
|
|
5c85e31a21 | ||
|
|
e17dc838a2 | ||
|
|
3cdf17e1bc | ||
|
|
994cd0801d | ||
|
|
e130ae32c2 | ||
|
|
d8a3970e14 | ||
|
|
d98f4ae88e | ||
|
|
6673ce68ff | ||
|
|
535918a3ed | ||
|
|
32fcb33604 | ||
|
|
d13dfdef40 | ||
|
|
b23de068c5 | ||
|
|
7f94518f6b | ||
|
|
53aded7bf3 | ||
|
|
7a984c7f84 | ||
|
|
8aa70882b4 | ||
|
|
fe2d67c9c0 | ||
|
|
115bce064e | ||
|
|
4994e375a1 | ||
|
|
64c9e797b8 | ||
|
|
ceb6e819d3 | ||
|
|
ea716a8f46 | ||
|
|
715957bffc | ||
|
|
981e448b36 | ||
|
|
439778a2be | ||
|
|
7b3c30d8c8 | ||
|
|
70a836c34d | ||
|
|
75ac1ea512 | ||
|
|
d07c233422 | ||
|
|
bd72320946 | ||
|
|
2ba5f9d80d | ||
|
|
9b32ced2b4 | ||
|
|
a6bc1d4e69 | ||
|
|
2df9a9a863 | ||
|
|
19dd8f8318 | ||
|
|
4caa411f01 | ||
|
|
fccc4824cc | ||
|
|
ef3c095baf | ||
|
|
3f22747dfb | ||
|
|
ca028d751f | ||
|
|
97c7ae774a | ||
|
|
6727b542ac | ||
|
|
ad423ae3fd | ||
|
|
e88011b49b | ||
|
|
01f0a9f999 | ||
|
|
d2223de26a | ||
|
|
8cbb3e7155 | ||
|
|
7467f9c041 | ||
|
|
3233fdeeec | ||
|
|
2aabc1a276 | ||
|
|
c8b87abd01 | ||
|
|
94b065fb97 | ||
|
|
9fe23b3f82 | ||
|
|
c4ef2f3810 | ||
|
|
2fef4ad3ee | ||
|
|
20976f7af4 | ||
|
|
64561534a6 | ||
|
|
bf52178981 | ||
|
|
e1702af5ee | ||
|
|
014b6d4153 | ||
|
|
b139b59797 | ||
|
|
6c1e80d6dd | ||
|
|
2fb6ac3369 | ||
|
|
50daa07400 | ||
|
|
b44a12d78c | ||
|
|
fa785e0ef0 | ||
|
|
c86f2b52c0 | ||
|
|
0062417c59 | ||
|
|
98e4ca1edf | ||
|
|
21933ec1ee | ||
|
|
85d8cc0ac0 | ||
|
|
1311138f3e | ||
|
|
1b3690933e | ||
|
|
b87096669b | ||
|
|
7344d57029 | ||
|
|
060315b591 | ||
|
|
5f2b327595 | ||
|
|
1e79f7b7df | ||
|
|
c6dbb2892b | ||
|
|
c996f0e685 | ||
|
|
f10f81a241 | ||
|
|
00be05ad18 | ||
|
|
5fe1dda97c | ||
|
|
113c98f849 | ||
|
|
341992913b | ||
|
|
1c9145c9a7 | ||
|
|
e13f5c4b37 | ||
|
|
d9cc711ea1 | ||
|
|
55a7fc2466 | ||
|
|
99e140ded4 | ||
|
|
b77d30c2f0 | ||
|
|
b191777977 | ||
|
|
6241a72722 | ||
|
|
2db692e752 | ||
|
|
6c5b7719a6 | ||
|
|
a314d2a374 | ||
|
|
a81061aa37 | ||
|
|
0d4f6b5261 | ||
|
|
a556e26cb5 | ||
|
|
cde1dc4f5c | ||
|
|
601fbc59e4 | ||
|
|
28b1ca4b8c | ||
|
|
ce89a01bef | ||
|
|
7b95c57e2d | ||
|
|
44bc2bdbf2 | ||
|
|
00d8b84570 | ||
|
|
458cd36309 | ||
|
|
586dc13ee3 | ||
|
|
4238aed87d | ||
|
|
a48bd3ebaf | ||
|
|
19450d9d59 | ||
|
|
7fca5a5adf | ||
|
|
7668263695 | ||
|
|
d15376de77 | ||
|
|
413822acbc | ||
|
|
11158f1bc4 | ||
|
|
0b15ec7d6d | ||
|
|
05d83fcfeb | ||
|
|
53f28cf87d | ||
|
|
4c9e90e730 | ||
|
|
c537194736 | ||
|
|
fd345072df | ||
|
|
51d121e79a | ||
|
|
777f14fa93 | ||
|
|
0a7a6f82bf | ||
|
|
2792309862 | ||
|
|
976fc0f9ba | ||
|
|
aee2fa8f29 | ||
|
|
73f6f66039 | ||
|
|
e7e087854b | ||
|
|
b14b4a60d1 | ||
|
|
8b168ad3b1 | ||
|
|
f2f59b04ec | ||
|
|
727ef92941 | ||
|
|
5c97f98709 | ||
|
|
41246db22b | ||
|
|
3611b4c4e0 | ||
|
|
299291e6be | ||
|
|
0d1c066177 | ||
|
|
ffb7b8e359 | ||
|
|
401e66acb4 | ||
|
|
e49793fdc9 | ||
|
|
a36c13a732 | ||
|
|
9a6433f92f | ||
|
|
bd88d3e457 | ||
|
|
58816dd249 | ||
|
|
8175a1c468 | ||
|
|
ebe10aef34 | ||
|
|
e52f6af093 | ||
|
|
559bc56768 | ||
|
|
78641b530f | ||
|
|
6fee66d751 | ||
|
|
c23caaf1d8 | ||
|
|
b4229a4d49 | ||
|
|
3f3f95de4e | ||
|
|
acdae81735 | ||
|
|
7f52ddf680 | ||
|
|
dc1604c697 | ||
|
|
d965db4c5e | ||
|
|
f78016f555 | ||
|
|
c72a81c5e9 | ||
|
|
639cb05ba0 | ||
|
|
5416bcd103 | ||
|
|
37446e28af | ||
|
|
a709725b06 | ||
|
|
d3dc77b211 | ||
|
|
7db1acaeb5 | ||
|
|
29c7e128cd | ||
|
|
09a8c715cb | ||
|
|
536b6ace6b | ||
|
|
f4a43fd2e4 | ||
|
|
c80cc610e2 | ||
|
|
fca04b1e3e | ||
|
|
e150d87944 | ||
|
|
b131981d84 | ||
|
|
d19dea0572 | ||
|
|
f5e2524c96 | ||
|
|
3fb77e0cfa | ||
|
|
e3367bc021 | ||
|
|
e12930a242 | ||
|
|
8e0864f509 | ||
|
|
93f0e38c51 | ||
|
|
705493215e | ||
|
|
02e749a3f4 | ||
|
|
d9146777db | ||
|
|
f7da334d36 | ||
|
|
8628fef73e | ||
|
|
35872f2e58 | ||
|
|
ddd7ae43a5 | ||
|
|
954d45cbcb | ||
|
|
f569ad9813 | ||
|
|
210fbe0947 | ||
|
|
86581681eb | ||
|
|
26a391c60d | ||
|
|
b125225228 | ||
|
|
b61671ccc6 | ||
|
|
91f39213da | ||
|
|
036b1e5e4b | ||
|
|
401250356e | ||
|
|
2d09367d64 | ||
|
|
0928889ddc | ||
|
|
fbfbbd5dad | ||
|
|
14ba59535e | ||
|
|
6edd2cb9b2 | ||
|
|
5e26749118 | ||
|
|
b84c9aeb50 | ||
|
|
4c8e51a459 | ||
|
|
8ace459e0e | ||
|
|
c03be7e137 | ||
|
|
bca1d30716 | ||
|
|
82c2125692 | ||
|
|
5572931889 | ||
|
|
b37d518d81 | ||
|
|
d5d05a36cd | ||
|
|
94c63ee571 | ||
|
|
b49ca17032 | ||
|
|
6aba703c89 | ||
|
|
73b878bf9e | ||
|
|
ddaf66a515 | ||
|
|
e9f342b91f | ||
|
|
6d8a8ef805 | ||
|
|
31025414e9 | ||
|
|
4f2003b5fe | ||
|
|
bfe9a84023 | ||
|
|
929eeccc5f | ||
|
|
2f370b8156 | ||
|
|
d97a2ff818 | ||
|
|
ff68f939b6 | ||
|
|
1a54c57370 | ||
|
|
0b5d68c0af | ||
|
|
bec3000690 | ||
|
|
bc1b720915 | ||
|
|
dab7d7ebc7 | ||
|
|
b4432895b5 | ||
|
|
7610e41dad | ||
|
|
b10c7c04c4 | ||
|
|
83f3d6ab09 | ||
|
|
ef41c51637 | ||
|
|
a2c89c0964 | ||
|
|
dc31d7c852 | ||
|
|
e02dd35b51 | ||
|
|
452c2836b2 | ||
|
|
2834081fac | ||
|
|
7f31896fd4 | ||
|
|
9cba6fcae9 | ||
|
|
26463fe491 | ||
|
|
0a3456758b | ||
|
|
ab3abb63db | ||
|
|
4504c11445 | ||
|
|
695d2ca304 | ||
|
|
7b37e95341 | ||
|
|
7227e7fb27 | ||
|
|
fdbbc12871 | ||
|
|
bad4fb5288 | ||
|
|
d9f114c019 | ||
|
|
5c93b03069 | ||
|
|
c7f763c966 | ||
|
|
c24b78462a | ||
|
|
3300a6847f | ||
|
|
347e0c0053 | ||
|
|
1d0ec96931 | ||
|
|
fdb8f6aced | ||
|
|
a30e338dc5 | ||
|
|
14608f44cf | ||
|
|
cbbaaecc0e | ||
|
|
7f53f98ec7 | ||
|
|
b4a91bda9f | ||
|
|
e5e057e538 | ||
|
|
362d0b78d3 | ||
|
|
bb94ded9f3 | ||
|
|
9ee01e94dc | ||
|
|
91ff0b8fec | ||
|
|
1f94b05317 | ||
|
|
648026d780 | ||
|
|
24f174de59 | ||
|
|
1cec539712 | ||
|
|
b6a8dec0e4 | ||
|
|
0e1c7ba929 | ||
|
|
f467a7e84b | ||
|
|
c5289aad2b | ||
|
|
4c3301b9cc | ||
|
|
e3d389a171 | ||
|
|
974d1e2d0b | ||
|
|
3522122e31 | ||
|
|
fb41ccd538 | ||
|
|
4bbbfc88de | ||
|
|
0c9eec9b52 | ||
|
|
5cad48ced5 | ||
|
|
8a3955dae6 | ||
|
|
59b993abe9 | ||
|
|
b0685726da | ||
|
|
0e41abd9e2 | ||
|
|
caab9d30bd | ||
|
|
e10e3f04b4 | ||
|
|
98180a91f9 | ||
|
|
0e2062cb4a | ||
|
|
7d792b6845 | ||
|
|
e65c1ad37f | ||
|
|
9c1188592a | ||
|
|
1faa76a804 | ||
|
|
f4283547f8 | ||
|
|
2833b89914 | ||
|
|
d284eac8fd | ||
|
|
6a71a7e9d5 | ||
|
|
cf2ee8e826 | ||
|
|
ef83a0481e | ||
|
|
758f2f4f4c | ||
|
|
e7089e8cf8 | ||
|
|
8e36358c04 | ||
|
|
496898500c | ||
|
|
fe1d2a3f70 | ||
|
|
dbed4dacf7 | ||
|
|
fd2a816d53 | ||
|
|
a7361c1a13 | ||
|
|
3180b3f3dd | ||
|
|
1a398b3eaf | ||
|
|
61557bbe09 | ||
|
|
1d229e42d1 | ||
|
|
d96d5b6c8b | ||
|
|
7bc7e96d96 | ||
|
|
edd1da8572 | ||
|
|
ffa8bc9438 | ||
|
|
c1e3a7e6b4 | ||
|
|
6ce2a0f9f9 | ||
|
|
ac92ae7a5f | ||
|
|
37462b1bcc | ||
|
|
fc7d9e1ebb | ||
|
|
b2faa1fc3c | ||
|
|
1b78ceb957 | ||
|
|
9a9660b2f9 | ||
|
|
5373835d17 | ||
|
|
7e5efcc23c | ||
|
|
a2274d1993 | ||
|
|
a59a243eda | ||
|
|
c0d3d939d7 | ||
|
|
b62ca34b72 | ||
|
|
5b0dd0f4df | ||
|
|
6ee79bc4ba | ||
|
|
72bb744064 | ||
|
|
0e18366fc5 | ||
|
|
45cd0378d5 | ||
|
|
24b0f14ca0 | ||
|
|
0843a608eb | ||
|
|
1cf9f7487f | ||
|
|
d2acfe0654 | ||
|
|
eab37feb45 | ||
|
|
f1a8fbf649 | ||
|
|
043491dea5 | ||
|
|
b817d1758c | ||
|
|
a0ac99a4d9 | ||
|
|
96d7b26406 | ||
|
|
c35755b8d6 | ||
|
|
e3007f0b31 | ||
|
|
2d4ddfeca9 | ||
|
|
164dcab88b | ||
|
|
5ea8b6446b | ||
|
|
ce6878eeb4 | ||
|
|
7ef42605c2 | ||
|
|
b736756a92 | ||
|
|
3820568da4 | ||
|
|
ce7e249ae4 | ||
|
|
8185bc313a | ||
|
|
bb22ca66a8 | ||
|
|
5b6db9d0bd | ||
|
|
edf9c3fbdb | ||
|
|
9b1a477b12 | ||
|
|
41c657a05a | ||
|
|
b9341fe4ce | ||
|
|
91fa216839 | ||
|
|
e4edeff4fa | ||
|
|
4dc87b52c2 | ||
|
|
71880dee16 | ||
|
|
5c9fa3a83d | ||
|
|
19fec34e0d | ||
|
|
50fb1a7870 | ||
|
|
69039d03b9 | ||
|
|
2fedc604cc | ||
|
|
aa3068c8e0 | ||
|
|
7f73ae3d72 | ||
|
|
94cb8195b7 | ||
|
|
5b4ddd3a58 | ||
|
|
dc5379c0c9 | ||
|
|
828141a41d | ||
|
|
d7d467e69e | ||
|
|
ff3ed8f402 | ||
|
|
caeb9138fc | ||
|
|
17894ff685 | ||
|
|
a39f656d95 |
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* text=auto
|
||||
38
.gitignore
vendored
@@ -1,36 +1,2 @@
|
||||
# Numerous always-ignore extensions
|
||||
*.diff
|
||||
*.err
|
||||
*.orig
|
||||
*.log
|
||||
*.rej
|
||||
*.swo
|
||||
*.swp
|
||||
*.vi
|
||||
*~
|
||||
|
||||
# OS or Editor folders
|
||||
.DS_Store
|
||||
.cache
|
||||
.project
|
||||
.settings
|
||||
nbproject
|
||||
thumbs.db
|
||||
|
||||
# Dreamweaver added files
|
||||
_notes
|
||||
dwsync.xml
|
||||
|
||||
# Komodo
|
||||
*.komodoproject
|
||||
.komodotools
|
||||
|
||||
# Folders to ignore
|
||||
.hg
|
||||
.svn
|
||||
publish
|
||||
.idea
|
||||
|
||||
# build script local files
|
||||
build/buildinfo.properties
|
||||
build/config/buildinfo.properties
|
||||
# Include your project-specific ignores in this file
|
||||
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
|
||||
|
||||
471
.htaccess
@@ -1,8 +1,8 @@
|
||||
# Apache configuration file
|
||||
# httpd.apache.org/docs/2.2/mod/quickreference.html
|
||||
|
||||
# Note .htaccess files are an overhead, this logic should be in your Apache config if possible
|
||||
# httpd.apache.org/docs/2.2/howto/htaccess.html
|
||||
# Note .htaccess files are an overhead, this logic should be in your Apache
|
||||
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
|
||||
|
||||
# Techniques in here adapted from all over, including:
|
||||
# Kroc Camen: camendesign.com/.htaccess
|
||||
@@ -10,13 +10,6 @@
|
||||
# Sample .htaccess file of CMS MODx: modxcms.com
|
||||
|
||||
|
||||
###
|
||||
### If you run a webserver other than apache, consider:
|
||||
### github.com/paulirish/html5-boilerplate-server-configs
|
||||
###
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Better website experience for IE users
|
||||
# ----------------------------------------------------------------------
|
||||
@@ -25,18 +18,12 @@
|
||||
# github.com/rails/rails/commit/123eb25#commitcomment-118920
|
||||
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
|
||||
|
||||
<IfModule mod_setenvif.c>
|
||||
<IfModule mod_headers.c>
|
||||
BrowserMatch MSIE ie
|
||||
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
# Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
|
||||
# We need to inform proxies that content changes based on UA
|
||||
Header append Vary User-Agent
|
||||
# Cache control is set only if mod_headers is enabled, so that's unncessary to declare
|
||||
Header set X-UA-Compatible "IE=Edge,chrome=1"
|
||||
# mod_headers can't match by content-type, but we don't want to send this header on *everything*...
|
||||
<FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
|
||||
Header unset X-UA-Compatible
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
|
||||
@@ -44,7 +31,7 @@
|
||||
# Cross-domain AJAX requests
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Serve cross-domain ajax requests, disabled.
|
||||
# Serve cross-domain Ajax requests, disabled by default.
|
||||
# enable-cors.org
|
||||
# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
|
||||
|
||||
@@ -53,128 +40,163 @@
|
||||
# </IfModule>
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# CORS-enabled images (@crossorigin)
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Send CORS headers if browsers request them; enabled by default for images.
|
||||
# developer.mozilla.org/en/CORS_Enabled_Image
|
||||
# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
|
||||
# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
|
||||
# wiki.mozilla.org/Security/Reviews/crossoriginAttribute
|
||||
|
||||
<IfModule mod_setenvif.c>
|
||||
<IfModule mod_headers.c>
|
||||
# mod_headers, y u no match by Content-Type?!
|
||||
<FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
|
||||
SetEnvIf Origin ":" IS_CORS
|
||||
Header set Access-Control-Allow-Origin "*" env=IS_CORS
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Webfont access
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# allow access from all domains for webfonts
|
||||
# alternatively you could only whitelist
|
||||
# your subdomains like "sub.domain.com"
|
||||
# Allow access from all domains for webfonts.
|
||||
# Alternatively you could only whitelist your
|
||||
# subdomains like "subdomain.example.com".
|
||||
|
||||
<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
|
||||
<IfModule mod_headers.c>
|
||||
<IfModule mod_headers.c>
|
||||
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
|
||||
Header set Access-Control-Allow-Origin "*"
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Proper MIME type for all files
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# audio
|
||||
# JavaScript
|
||||
# Normalize to standard type (it's sniffed in IE anyways)
|
||||
# tools.ietf.org/html/rfc4329#section-7.2
|
||||
AddType application/javascript js jsonp
|
||||
AddType application/json json
|
||||
|
||||
# Audio
|
||||
AddType audio/ogg oga ogg
|
||||
AddType audio/mp4 m4a f4a f4b
|
||||
|
||||
# video
|
||||
# Video
|
||||
AddType video/ogg ogv
|
||||
AddType video/mp4 mp4
|
||||
AddType video/mp4 mp4 m4v f4v f4p
|
||||
AddType video/webm webm
|
||||
AddType video/x-flv flv
|
||||
|
||||
# Proper svg serving. Required for svg webfonts on iPad
|
||||
# SVG
|
||||
# Required for svg webfonts on iPad
|
||||
# twitter.com/FontSquirrel/status/14855840545
|
||||
AddType image/svg+xml svg svgz
|
||||
AddType image/svg+xml svg svgz
|
||||
AddEncoding gzip svgz
|
||||
|
||||
# webfonts
|
||||
|
||||
# Webfonts
|
||||
AddType application/vnd.ms-fontobject eot
|
||||
AddType font/truetype ttf
|
||||
AddType application/x-font-ttf ttf ttc
|
||||
AddType font/opentype otf
|
||||
AddType application/x-font-woff woff
|
||||
|
||||
# assorted types
|
||||
AddType image/x-icon ico
|
||||
AddType image/webp webp
|
||||
AddType text/cache-manifest appcache manifest
|
||||
AddType text/x-component htc
|
||||
AddType application/x-chrome-extension crx
|
||||
AddType application/x-xpinstall xpi
|
||||
AddType application/octet-stream safariextz
|
||||
|
||||
# Assorted types
|
||||
AddType image/x-icon ico
|
||||
AddType image/webp webp
|
||||
AddType text/cache-manifest appcache manifest
|
||||
AddType text/x-component htc
|
||||
AddType application/xml rss atom xml rdf
|
||||
AddType application/x-chrome-extension crx
|
||||
AddType application/x-opera-extension oex
|
||||
AddType application/x-xpinstall xpi
|
||||
AddType application/octet-stream safariextz
|
||||
AddType application/x-web-app-manifest+json webapp
|
||||
AddType text/x-vcard vcf
|
||||
AddType application/x-shockwave-flash swf
|
||||
AddType text/vtt vtt
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Allow concatenation from within specific js and css files
|
||||
# Allow concatenation from within specific js and css files
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# e.g. Inside of script.combined.js you could have
|
||||
# <!--#include file="libs/jquery-1.5.0.min.js" -->
|
||||
# <!--#include file="plugins/jquery.idletimer.js" -->
|
||||
# and they would be included into this single file
|
||||
# and they would be included into this single file.
|
||||
|
||||
# this is not in use in the boilerplate as it stands. you may
|
||||
# choose to name your files in this way for this advantage
|
||||
# or concatenate and minify them manually.
|
||||
# Disabled by default.
|
||||
# This is not in use in the boilerplate as it stands. You may
|
||||
# choose to use this technique if you do not have a build process.
|
||||
|
||||
# <FilesMatch "\.combined\.(js|css)$">
|
||||
# Options +Includes
|
||||
# SetOutputFilter INCLUDES
|
||||
# </FilesMatch>
|
||||
#<FilesMatch "\.combined\.js$">
|
||||
# Options +Includes
|
||||
# AddOutputFilterByType INCLUDES application/javascript application/json
|
||||
# SetOutputFilter INCLUDES
|
||||
#</FilesMatch>
|
||||
|
||||
#<FilesMatch "\.combined\.css$">
|
||||
# Options +Includes
|
||||
# AddOutputFilterByType INCLUDES text/css
|
||||
# SetOutputFilter INCLUDES
|
||||
#</FilesMatch>
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# gzip compression
|
||||
# Gzip compression
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
<IfModule mod_deflate.c>
|
||||
|
||||
|
||||
# force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
|
||||
<IfModule mod_setenvif.c>
|
||||
<IfModule mod_headers.c>
|
||||
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s,?\s(gzip|deflate)?|X{4,13}|~{4,13}|-{4,13})$ HAVE_Accept-Encoding
|
||||
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
|
||||
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
|
||||
<IfModule mod_setenvif.c>
|
||||
<IfModule mod_headers.c>
|
||||
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
|
||||
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
# html, txt, css, js, json, xml, htc:
|
||||
<IfModule filter_module>
|
||||
FilterDeclare COMPRESS
|
||||
FilterProvider COMPRESS DEFLATE resp=Content-Type /text/(html|css|javascript|plain|x(ml|-component))/
|
||||
FilterProvider COMPRESS DEFLATE resp=Content-Type /application/(javascript|json|xml|x-javascript)/
|
||||
FilterChain COMPRESS
|
||||
FilterProtocol COMPRESS change=yes;byteranges=no
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_filter.c>
|
||||
# Legacy versions of Apache
|
||||
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
|
||||
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
|
||||
</IfModule>
|
||||
# Compress all output labeled with one of the following MIME-types
|
||||
<IfModule mod_filter.c>
|
||||
AddOutputFilterByType DEFLATE application/atom+xml \
|
||||
application/javascript \
|
||||
application/json \
|
||||
application/rss+xml \
|
||||
application/vnd.ms-fontobject \
|
||||
application/x-font-ttf \
|
||||
application/xhtml+xml \
|
||||
application/xml \
|
||||
font/opentype \
|
||||
image/svg+xml \
|
||||
image/x-icon \
|
||||
text/css \
|
||||
text/html \
|
||||
text/plain \
|
||||
text/x-component \
|
||||
text/xml
|
||||
</IfModule>
|
||||
|
||||
# webfonts and svg:
|
||||
<FilesMatch "\.(ttf|otf|eot|svg)$" >
|
||||
SetOutputFilter DEFLATE
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Expires headers (for better cache control)
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# these are pretty far-future expires headers
|
||||
# they assume you control versioning with cachebusting query params like
|
||||
# <script src="application.js?20100608">
|
||||
# additionally, consider that outdated proxies may miscache
|
||||
# These are pretty far-future expires headers.
|
||||
# They assume you control versioning with filename-based cache busting
|
||||
# Additionally, consider that outdated proxies may miscache
|
||||
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
|
||||
|
||||
# if you don't use filenames to version, lower the css and js to something like
|
||||
# "access plus 1 week" or so
|
||||
# If you don't use filenames to version, lower the CSS and JS to something like
|
||||
# "access plus 1 week".
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive on
|
||||
@@ -182,74 +204,84 @@ AddType application/octet-stream safariextz
|
||||
# Perhaps better to whitelist expires rules? Perhaps.
|
||||
ExpiresDefault "access plus 1 month"
|
||||
|
||||
# cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
|
||||
# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
|
||||
ExpiresByType text/cache-manifest "access plus 0 seconds"
|
||||
|
||||
# your document html
|
||||
# Your document html
|
||||
ExpiresByType text/html "access plus 0 seconds"
|
||||
|
||||
# data
|
||||
|
||||
# Data
|
||||
ExpiresByType text/xml "access plus 0 seconds"
|
||||
ExpiresByType application/xml "access plus 0 seconds"
|
||||
ExpiresByType application/json "access plus 0 seconds"
|
||||
|
||||
# rss feed
|
||||
# Feed
|
||||
ExpiresByType application/rss+xml "access plus 1 hour"
|
||||
ExpiresByType application/atom+xml "access plus 1 hour"
|
||||
|
||||
# favicon (cannot be renamed)
|
||||
ExpiresByType image/x-icon "access plus 1 week"
|
||||
# Favicon (cannot be renamed)
|
||||
ExpiresByType image/x-icon "access plus 1 week"
|
||||
|
||||
# media: images, video, audio
|
||||
# Media: images, video, audio
|
||||
ExpiresByType image/gif "access plus 1 month"
|
||||
ExpiresByType image/png "access plus 1 month"
|
||||
ExpiresByType image/jpg "access plus 1 month"
|
||||
ExpiresByType image/jpeg "access plus 1 month"
|
||||
ExpiresByType video/ogg "access plus 1 month"
|
||||
ExpiresByType audio/ogg "access plus 1 month"
|
||||
ExpiresByType video/mp4 "access plus 1 month"
|
||||
ExpiresByType video/webm "access plus 1 month"
|
||||
|
||||
# htc files (css3pie)
|
||||
|
||||
# HTC files (css3pie)
|
||||
ExpiresByType text/x-component "access plus 1 month"
|
||||
|
||||
# webfonts
|
||||
ExpiresByType font/truetype "access plus 1 month"
|
||||
|
||||
# Webfonts
|
||||
ExpiresByType application/x-font-ttf "access plus 1 month"
|
||||
ExpiresByType font/opentype "access plus 1 month"
|
||||
ExpiresByType application/x-font-woff "access plus 1 month"
|
||||
ExpiresByType image/svg+xml "access plus 1 month"
|
||||
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
|
||||
|
||||
# css and javascript
|
||||
ExpiresByType text/css "access plus 2 months"
|
||||
ExpiresByType application/javascript "access plus 2 months"
|
||||
ExpiresByType text/javascript "access plus 2 months"
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
Header append Cache-Control "public"
|
||||
</IfModule>
|
||||
|
||||
|
||||
# CSS and JavaScript
|
||||
ExpiresByType text/css "access plus 1 year"
|
||||
ExpiresByType application/javascript "access plus 1 year"
|
||||
|
||||
</IfModule>
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Prevent mobile network providers from modifying your site
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# The following header prevents modification of your code over 3G on some
|
||||
# European providers.
|
||||
# This is the official 'bypass' suggested by O2 in the UK.
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set Cache-Control "no-transform"
|
||||
# </IfModule>
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# ETag removal
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# FileETag None is not enough for every server.
|
||||
<IfModule mod_headers.c>
|
||||
Header unset ETag
|
||||
</IfModule>
|
||||
|
||||
# Since we're sending far-future expires, we don't need ETags for
|
||||
# static content.
|
||||
# developer.yahoo.com/performance/rules.html#etags
|
||||
FileETag None
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Stop screen flicker in IE on CSS rollovers
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# The following directives stop screen flicker in IE on CSS rollovers - in
|
||||
# combination with the "ExpiresByType" rules for images (see above). If
|
||||
# needed, un-comment the following rules.
|
||||
# combination with the "ExpiresByType" rules for images (see above).
|
||||
|
||||
# BrowserMatch "MSIE" brokenvary=1
|
||||
# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
|
||||
@@ -257,123 +289,107 @@ FileETag None
|
||||
# SetEnvIf brokenvary 1 force-no-vary
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Set Keep-Alive Header
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Keep-Alive allows the server to send multiple requests through one
|
||||
# TCP-connection. Be aware of possible disadvantages of this setting. Turn on
|
||||
# if you serve a lot of static content.
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set Connection Keep-Alive
|
||||
# </IfModule>
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Cookie setting from iframes
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Allow cookies to be set from iframes (for IE only)
|
||||
# If needed, uncomment and specify a path or regex in the Location directive
|
||||
# If needed, specify a path or regex in the Location directive.
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# <Location />
|
||||
# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
|
||||
# </Location>
|
||||
# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
|
||||
# </IfModule>
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Start rewrite engine
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Turning on the rewrite engine is necessary for the following rules and features.
|
||||
# Turning on the rewrite engine is necessary for the following rules and
|
||||
# features. FollowSymLinks must be enabled for this to work.
|
||||
|
||||
# Some cloud hosting services require RewriteBase to be set: goo.gl/HOcPN
|
||||
# If using the h5bp in a subdirectory, use `RewriteBase /foo` instead where
|
||||
# 'foo' is your directory.
|
||||
|
||||
# If your web host doesn't allow the FollowSymlinks option, you may need to
|
||||
# comment it out and use `Options +SymLinksOfOwnerMatch`, but be aware of the
|
||||
# performance impact: http://goo.gl/Mluzd
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
Options +FollowSymlinks
|
||||
# Options +SymLinksIfOwnerMatch
|
||||
RewriteEngine On
|
||||
# RewriteBase /
|
||||
</IfModule>
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Suppress or force the "www." at the beginning of URLs
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# The same content should never be available under two different URLs - especially not with and
|
||||
# without "www." at the beginning, since this can cause SEO problems (duplicate content).
|
||||
# That's why you should choose one of the alternatives and redirect the other one.
|
||||
# The same content should never be available under two different URLs -
|
||||
# especially not with and without "www." at the beginning, since this can cause
|
||||
# SEO problems (duplicate content). That's why you should choose one of the
|
||||
# alternatives and redirect the other one.
|
||||
|
||||
# By default option 1 (no "www.") is activated. Remember: Shorter URLs are sexier.
|
||||
# By default option 1 (no "www.") is activated.
|
||||
# no-www.org/faq.php?q=class_b
|
||||
|
||||
# If you rather want to use option 2, just comment out all option 1 lines
|
||||
# If you'd prefer to use option 2, just comment out all option 1 lines
|
||||
# and uncomment option 2.
|
||||
|
||||
# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Option 1:
|
||||
# Rewrite "www.domain.com -> domain.com"
|
||||
# Rewrite "www.example.com -> example.com".
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
||||
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
|
||||
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
|
||||
</IfModule>
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Option 2:
|
||||
# To rewrite "domain.com -> www.domain.com" uncomment the following lines.
|
||||
# Be aware that the following rule might not be a good idea if you
|
||||
# use "real" subdomains for certain parts of your website.
|
||||
# Rewrite "example.com -> www.example.com".
|
||||
# Be aware that the following rule might not be a good idea if you use "real"
|
||||
# subdomains for certain parts of your website.
|
||||
|
||||
# <IfModule mod_rewrite.c>
|
||||
# RewriteCond %{HTTPS} !=on
|
||||
# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
|
||||
# RewriteCond %{HTTP_HOST} (.+)$ [NC]
|
||||
# RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
|
||||
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
||||
# </IfModule>
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Add/remove trailing slash to (non-file) URLs
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Google treats URLs with and without trailing slashes separately.
|
||||
# Forcing a trailing slash is usually preferred, but all that's really
|
||||
# important is that one correctly redirects to the other.
|
||||
|
||||
# By default option 1 (force trailing slash) is activated.
|
||||
# http://googlewebmastercentral.blogspot.com/2010/04/to-slash-or-not-to-slash.html
|
||||
# http://www.alistapart.com/articles/slashforward/
|
||||
# http://httpd.apache.org/docs/2.0/misc/rewriteguide.html#url Trailing Slash Problem
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Option 1:
|
||||
# Rewrite "domain.com/foo -> domain.com/foo/"
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
|
||||
RewriteRule ^(.*)$ /$1/ [R=301,L]
|
||||
</IfModule>
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Option 2:
|
||||
# Rewrite "domain.com/foo/ -> domain.com/foo"
|
||||
|
||||
#<IfModule mod_rewrite.c>
|
||||
# RewriteRule ^(.*)/$ /$1 [R=301,L]
|
||||
#</IfModule>
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Built-in filename-based cache busting
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# If you're not using the build script to manage your filename version revving,
|
||||
# you might want to consider enabling this, which will route requests for
|
||||
# /css/all.20110203.css to /res/all.css
|
||||
# /css/style.20110203.css to /css/style.css
|
||||
|
||||
# To understand why this is important and a better idea than all.css?v1231,
|
||||
# read: github.com/paulirish/html5-boilerplate/wiki/Version-Control-with-Cachebusting
|
||||
# read: github.com/h5bp/html5-boilerplate/wiki/cachebusting
|
||||
|
||||
# Uncomment to enable.
|
||||
# <IfModule mod_rewrite.c>
|
||||
# RewriteCond %{REQUEST_FILENAME} !-f
|
||||
# RewriteCond %{REQUEST_FILENAME} !-d
|
||||
@@ -381,84 +397,91 @@ FileETag None
|
||||
# </IfModule>
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Prevent SSL cert warnings
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
|
||||
# https://www.domain.com when your cert only allows https://secure.domain.com
|
||||
# Uncomment the following lines to use this feature.
|
||||
# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
|
||||
# https://www.example.com when your cert only allows https://secure.example.com
|
||||
|
||||
# <IfModule mod_rewrite.c>
|
||||
# RewriteCond %{SERVER_PORT} !^443
|
||||
# RewriteRule (.*) https://example-domain-please-change-me.com/$1 [R=301,L]
|
||||
# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
|
||||
# </IfModule>
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Prevent 404 errors for non-existing redirected folders
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist
|
||||
# e.g. /blog/hello : webmasterworld.com/apache/3808792.htm
|
||||
|
||||
Options -MultiViews
|
||||
# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the
|
||||
# same name does not exist.
|
||||
# webmasterworld.com/apache/3808792.htm
|
||||
|
||||
Options -MultiViews
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# custom 404 page
|
||||
# Custom 404 page
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# You can add custom pages to handle 500 or 403 pretty easily, if you like.
|
||||
# If you are hosting your site in subdirectory, adjust this accordingly
|
||||
# e.g. ErrorDocument 404 /subdir/404.html
|
||||
ErrorDocument 404 /404.html
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# UTF-8 encoding
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# use utf-8 encoding for anything served text/plain or text/html
|
||||
# Use UTF-8 encoding for anything served text/plain or text/html
|
||||
AddDefaultCharset utf-8
|
||||
|
||||
# force utf-8 for a number of file formats
|
||||
AddCharset utf-8 .html .css .js .xml .json .rss
|
||||
|
||||
# Force UTF-8 for a number of file formats
|
||||
AddCharset utf-8 .atom .css .js .json .rss .vtt .xml
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# A little more security
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
# Do we want to advertise the exact version number of Apache we're running?
|
||||
# Probably not.
|
||||
## This can only be enabled if used in httpd.conf - It will not work in .htaccess
|
||||
# To avoid displaying the exact version number of Apache being used, add the
|
||||
# following to httpd.conf (it will not work in .htaccess):
|
||||
# ServerTokens Prod
|
||||
|
||||
# "-Indexes" will have Apache block users from browsing folders without a
|
||||
# default document Usually you should leave this activated, because you
|
||||
# shouldn't allow everybody to surf through every folder on your server (which
|
||||
# includes rather private places like CMS system folders).
|
||||
<IfModule mod_autoindex.c>
|
||||
Options -Indexes
|
||||
</IfModule>
|
||||
|
||||
# "-Indexes" will have Apache block users from browsing folders without a default document
|
||||
# Usually you should leave this activated, because you shouldn't allow everybody to surf through
|
||||
# every folder on your server (which includes rather private places like CMS system folders).
|
||||
# Options -Indexes
|
||||
|
||||
|
||||
# Block access to "hidden" directories whose names begin with a period. This
|
||||
# includes directories used by version control systems such as Subversion or Git.
|
||||
# Block access to "hidden" directories or files whose names begin with a
|
||||
# period. This includes directories used by version control systems such as
|
||||
# Subversion or Git.
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteCond %{SCRIPT_FILENAME} -d [OR]
|
||||
RewriteCond %{SCRIPT_FILENAME} -f
|
||||
RewriteRule "(^|/)\." - [F]
|
||||
</IfModule>
|
||||
|
||||
# Block access to backup and source files. These files may be left by some
|
||||
# text/html editors and pose a great security danger, when anyone can access
|
||||
# them.
|
||||
<FilesMatch "(\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
Satisfy All
|
||||
</FilesMatch>
|
||||
|
||||
# If your server is not already configured as such, the following directive
|
||||
# should be uncommented in order to set PHP's register_globals option to OFF.
|
||||
# This closes a major security hole that is abused by most XSS (cross-site
|
||||
# scripting) attacks. For more information: http://php.net/register_globals
|
||||
#
|
||||
# IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
|
||||
# IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS:
|
||||
#
|
||||
# Your server does not allow PHP directives to be set via .htaccess. In that
|
||||
# case you must make this change in your php.ini file instead. If you are
|
||||
@@ -470,6 +493,48 @@ AddCharset utf-8 .html .css .js .xml .json .rss
|
||||
|
||||
# php_flag register_globals Off
|
||||
|
||||
# Rename session cookie to something else, than PHPSESSID
|
||||
# php_value session.name sid
|
||||
|
||||
# Disable magic quotes (This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.)
|
||||
# php_flag magic_quotes_gpc Off
|
||||
|
||||
# Do not show you are using PHP
|
||||
# Note: Move this line to php.ini since it won't work in .htaccess
|
||||
# php_flag expose_php Off
|
||||
|
||||
# Level of log detail - log all errors
|
||||
# php_value error_reporting -1
|
||||
|
||||
# Write errors to log file
|
||||
# php_flag log_errors On
|
||||
|
||||
# Do not display errors in browser (production - Off, development - On)
|
||||
# php_flag display_errors Off
|
||||
|
||||
# Do not display startup errors (production - Off, development - On)
|
||||
# php_flag display_startup_errors Off
|
||||
|
||||
# Format errors in plain text
|
||||
# Note: Leave this setting 'On' for xdebug's var_dump() output
|
||||
# php_flag html_errors Off
|
||||
|
||||
# Show multiple occurrence of error
|
||||
# php_flag ignore_repeated_errors Off
|
||||
|
||||
# Show same errors from different sources
|
||||
# php_flag ignore_repeated_source Off
|
||||
|
||||
# Size limit for error messages
|
||||
# php_value log_errors_max_len 1024
|
||||
|
||||
# Don't precede error with string (doesn't accept empty string, use whitespace if you need)
|
||||
# php_value error_prepend_string " "
|
||||
|
||||
# Don't prepend to error (doesn't accept empty string, use whitespace if you need)
|
||||
# php_value error_append_string " "
|
||||
|
||||
# Increase cookie security
|
||||
<IfModule php5_module>
|
||||
php_value session.cookie_httponly true
|
||||
</IfModule>
|
||||
|
||||
187
404.html
@@ -1,32 +1,157 @@
|
||||
<!doctype html>
|
||||
<title>Page Not Found</title>
|
||||
<style>
|
||||
body { text-align: center;}
|
||||
h1 { font-size: 50px; text-align: center }
|
||||
span[frown] { transform: rotate(90deg); display:inline-block; color: #bbb; }
|
||||
body { font: 20px Constantia, 'Hoefler Text', "Adobe Caslon Pro", Baskerville, Georgia, Times, serif; color: #999; text-shadow: 2px 2px 2px rgba(200, 200, 200, 0.5); }
|
||||
::-moz-selection{ background:#FF5E99; color:#fff; }
|
||||
::selection { background:#FF5E99; color:#fff; }
|
||||
article {display:block; text-align: left; width: 500px; margin: 0 auto; }
|
||||
|
||||
a { color: rgb(36, 109, 56); text-decoration:none; }
|
||||
a:hover { color: rgb(96, 73, 141) ; text-shadow: 2px 2px 2px rgba(36, 109, 56, 0.5); }
|
||||
</style>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Page Not Found :(</title>
|
||||
<style>
|
||||
::-moz-selection {
|
||||
background: #b3d4fc;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
<article>
|
||||
<h1>Not found <span frown>:(</span></h1>
|
||||
<div>
|
||||
<p>Sorry, but the page you were trying to view does not exist.</p>
|
||||
<p>It looks like this was the result of either:</p>
|
||||
<ul>
|
||||
<li>a mistyped address</li>
|
||||
<li>an out-of-date link</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),
|
||||
GOOG_FIXURL_SITE = location.host;
|
||||
</script>
|
||||
<script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
|
||||
</article>
|
||||
::selection {
|
||||
background: #b3d4fc;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
html {
|
||||
padding: 30px 10px;
|
||||
font-size: 20px;
|
||||
line-height: 1.4;
|
||||
color: #737373;
|
||||
background: #f0f0f0;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
html,
|
||||
input {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 500px;
|
||||
_width: 500px;
|
||||
padding: 30px 20px 50px;
|
||||
border: 1px solid #b3b3b3;
|
||||
border-radius: 4px;
|
||||
margin: 0 auto;
|
||||
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
|
||||
background: #fcfcfc;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0 10px;
|
||||
font-size: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 span {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 1.5em 0 0.5em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0 0 0 40px;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 380px;
|
||||
_width: 380px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* google search */
|
||||
|
||||
#goog-fixurl ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#goog-fixurl form {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#goog-wm-qt,
|
||||
#goog-wm-sb {
|
||||
border: 1px solid #bbb;
|
||||
font-size: 16px;
|
||||
line-height: normal;
|
||||
vertical-align: top;
|
||||
color: #444;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
#goog-wm-qt {
|
||||
width: 220px;
|
||||
height: 20px;
|
||||
padding: 5px;
|
||||
margin: 5px 10px 0 0;
|
||||
box-shadow: inset 0 1px 1px #ccc;
|
||||
}
|
||||
|
||||
#goog-wm-sb {
|
||||
display: inline-block;
|
||||
height: 32px;
|
||||
padding: 0 10px;
|
||||
margin: 5px 0 0;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
background-color: #f5f5f5;
|
||||
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
|
||||
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
|
||||
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
|
||||
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
*overflow: visible;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
}
|
||||
|
||||
#goog-wm-sb:hover,
|
||||
#goog-wm-sb:focus {
|
||||
border-color: #aaa;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
#goog-wm-qt:hover,
|
||||
#goog-wm-qt:focus {
|
||||
border-color: #105cb6;
|
||||
outline: 0;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
input::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Not found <span>:(</span></h1>
|
||||
<p>Sorry, but the page you were trying to view does not exist.</p>
|
||||
<p>It looks like this was the result of either:</p>
|
||||
<ul>
|
||||
<li>a mistyped address</li>
|
||||
<li>an out-of-date link</li>
|
||||
</ul>
|
||||
<script>
|
||||
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
|
||||
</script>
|
||||
<script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
87
CHANGELOG.md
Normal file
@@ -0,0 +1,87 @@
|
||||
### HEAD
|
||||
|
||||
### 4.0.0 (28 August, 2012)
|
||||
|
||||
* Improve the Apache compression configuration ([#1012](https://github.com/h5bp/html5-boilerplate/issues/1012), [#1173](https://github.com/h5bp/html5-boilerplate/issues/1173)).
|
||||
* Add a HiDPI example media query ([#1127](https://github.com/h5bp/html5-boilerplate/issues/1127)).
|
||||
* Add bundled docs ([#1154](https://github.com/h5bp/html5-boilerplate/issues/1154)).
|
||||
* Add MIT license ([#1139](https://github.com/h5bp/html5-boilerplate/issues/1139)).
|
||||
* Update to Normalize.css 1.0.1.
|
||||
* Separate Normalize.css from the rest of the CSS ([#1160](https://github.com/h5bp/html5-boilerplate/issues/1160)).
|
||||
* Improve `console.log` protection ([#1107](https://github.com/h5bp/html5-boilerplate/issues/1107)).
|
||||
* Replace hot pink text selection color with a neutral color.
|
||||
* Change image replacement technique ([#1149](https://github.com/h5bp/html5-boilerplate/issues/1149)).
|
||||
* Code format and consistency changes ([#1112](https://github.com/h5bp/html5-boilerplate/issues/1112)).
|
||||
* Rename CSS file and rename JS files and subdirectories.
|
||||
* Update to jQuery 1.8 ([#1161](https://github.com/h5bp/html5-boilerplate/issues/1161)).
|
||||
* Update to Modernizr 2.6.1 ([#1086](https://github.com/h5bp/html5-boilerplate/issues/1086)).
|
||||
* Remove uncompressed jQuery ([#1153](https://github.com/h5bp/html5-boilerplate/issues/1153)).
|
||||
* Remove superfluous inline comments ([#1150](https://github.com/h5bp/html5-boilerplate/issues/1150)).
|
||||
|
||||
### 3.0.2 (February 19, 2012)
|
||||
|
||||
* Update to Modernizr 2.5.3.
|
||||
|
||||
### 3.0.1 (February 08, 2012).
|
||||
|
||||
* Update to Modernizr 2.5.2 (includes html5shiv 3.3).
|
||||
|
||||
### 3.0.0 (February 06, 2012)
|
||||
|
||||
* Improvements to `.htaccess`.
|
||||
* Improve 404 design.
|
||||
* Simplify JS folder structure.
|
||||
* Change `html` IE class names changed to target ranges rather than specific versions of IE.
|
||||
* Update CSS to include latest normalize.css changes and better typographic defaults ([#825](https://github.com/h5bp/html5-boilerplate/issues/825)).
|
||||
* Update to Modernizr 2.5 (includes yepnope 1.5 and html5shiv 3.2).
|
||||
* Update to jQuery 1.7.1.
|
||||
* Revert to async snippet for the Google Analytics script.
|
||||
* Remove the ant build script ([#826](https://github.com/h5bp/html5-boilerplate/issues/826)).
|
||||
* Remove Respond.js ([#816](https://github.com/h5bp/html5-boilerplate/issues/816)).
|
||||
* Remove the `demo/` directory ([#808](https://github.com/h5bp/html5-boilerplate/issues/808)).
|
||||
* Remove the `test/` directory ([#808](https://github.com/h5bp/html5-boilerplate/issues/808)).
|
||||
* Remove Google Chrome Frame script for IE6 users; replace with links to Chrome Frame and options for alternative browsers.
|
||||
* Remove `initial-scale=1` from the viewport `meta` ([#824](https://github.com/h5bp/html5-boilerplate/issues/824)).
|
||||
* Remove `defer` from all scripts to avoid legacy IE bugs.
|
||||
* Remove explicit Site Speed tracking for Google Analytics. It's now enabled by default.
|
||||
|
||||
### 2.0.0 (August 10, 2011)
|
||||
|
||||
* Change starting CSS to be based on normalize.css instead of reset.css ([#500](https://github.com/h5bp/html5-boilerplate/issues/500)).
|
||||
* Add Respond.js media query polyfill.
|
||||
* Add Google Chrome Frame script prompt for IE6 users.
|
||||
* Simplify the `html` conditional comments for modern browsers and add an `oldie` class.
|
||||
* Update clearfix to use "micro clearfix".
|
||||
* Add placeholder CSS MQs for mobile-first approach.
|
||||
* Add `textarea { resize: vertical; }` to only allow vertical resizing.
|
||||
* Add `img { max-width: 100%; }` to the print styles; prevents images being truncated.
|
||||
* Add Site Speed tracking for Google Analytics.
|
||||
* Update to jQuery 1.6.2 (and use minified by default).
|
||||
* Update to Modernizr 2.0 Complete, Production minified (includes yepnope, html5shiv, and Respond.js).
|
||||
* Use `Modernizr.load()` to load the Google Analytics script.
|
||||
* Much faster build process.
|
||||
* Add build script options for CSSLint, JSLint, JSHint tools.
|
||||
* Build script now compresses all images in subfolders.
|
||||
* Build script now versions files by SHA hash.
|
||||
* Many `.htaccess` improvements including: disable directory browsing, improved support for all versions of Apache, more robust and extensive HTTP compression rules.
|
||||
* Remove `handheld.css` as it has very poor device support.
|
||||
* Remove touch-icon `link` elements from the HTML and include improved touch-icon support.
|
||||
* Remove the cache-busting query paramaters from files references in the HTML.
|
||||
* Remove IE6 PNGFix.
|
||||
|
||||
### 1.0.0 (March 21, 2011)
|
||||
|
||||
* Rewrite build script to make it more customizable and flexible.
|
||||
* Add a humans.txt.
|
||||
* Numerous `.htaccess` improvements (including inline documentation).
|
||||
* Move the alternative server configurations to the H5BP server configs repo.
|
||||
* Use a protocol-relative url to reference jQuery and prevent mixed content warnings.
|
||||
* Optimize the Google Analytics snippet.
|
||||
* Use Eric Meyer's recent CSS reset update and the HTML5 Doctor reset.
|
||||
* More robust `sub`/`sup` CSS styles.
|
||||
* Add keyboard `.focusable` helper class that extends `.visuallyhidden`.
|
||||
* Print styles no longer print hash or JavaScript links.
|
||||
* Add a print reset for IE's proprietary filters.
|
||||
* Remove IE9-specific conditional class on the `html` element.
|
||||
* Remove margins from lists within `nav` elements.
|
||||
* Remove YUI profiling.
|
||||
@@ -1,21 +1,19 @@
|
||||
The MIT License
|
||||
Copyright (c) HTML5 Boilerplate
|
||||
|
||||
Copyright (c) 2011 Corey Hart
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
63
README.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# [HTML5 Boilerplate](http://html5boilerplate.com)
|
||||
|
||||
HTML5 Boilerplate is a professional front-end template for building fast,
|
||||
robust, and adaptable web apps or sites.
|
||||
|
||||
This project is the product of many years of iterative development and combined
|
||||
community knowledge. It does not impose a specific development philosophy or
|
||||
framework, so you're free to architect your code in the way that you want.
|
||||
|
||||
* Source: [https://github.com/h5bp/html5-boilerplate](https://github.com/h5bp/html5-boilerplate)
|
||||
* Homepage: [http://html5boilerplate.com](http://html5boilerplate.com)
|
||||
* Twitter: [@h5bp](http://twitter.com/h5bp)
|
||||
|
||||
|
||||
## Quick start
|
||||
|
||||
Choose one of the following options:
|
||||
|
||||
1. Download the latest stable release from
|
||||
[html5boilerplate.com](http://html5boilerplate.com/) or a custom build from
|
||||
[Initializr](http://www.initializr.com).
|
||||
2. Clone the git repo — `git clone
|
||||
https://github.com/h5bp/html5-boilerplate.git` - and checkout the tagged
|
||||
release you'd like to use.
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
* HTML5 ready. Use the new elements with confidence.
|
||||
* Cross-browser compatible (Chrome, Opera, Safari, Firefox 3.6+, IE6+).
|
||||
* Designed with progressive enhancement in mind.
|
||||
* Includes [Normalize.css](http://necolas.github.com/normalize.css/) for CSS
|
||||
normalizations and common bug fixes.
|
||||
* The latest [jQuery](http://jquery.com/) via CDN, with a local fallback.
|
||||
* The latest [Modernizr](http://modernizr.com/) build for feature detection.
|
||||
* IE-specific classes for easier cross-browser control.
|
||||
* Placeholder CSS Media Queries.
|
||||
* Useful CSS helpers.
|
||||
* Default print CSS, performance optimized.
|
||||
* Protection against any stray `console.log` causing JavaScript errors in
|
||||
IE6/7.
|
||||
* An optimized Google Analytics snippet.
|
||||
* Apache server caching, compression, and other configuration defaults for
|
||||
Grade-A performance.
|
||||
* Cross-domain Ajax and Flash.
|
||||
* "Delete-key friendly." Easy to strip out parts you don't need.
|
||||
* Extensive inline and accompanying documentation.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
Take a look at the [documentation table of
|
||||
contents](/h5bp/html5-boilerplate/blob/master/doc/README.md). This
|
||||
documentation is bundled with the project, which makes it readily available for
|
||||
offline reading and provides a useful starting point for any documentation
|
||||
you want to write about your project.
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Anyone and everyone is welcome to
|
||||
[contribute](/h5bp/html5-boilerplate/blob/master/doc/contribute.md). Hundreds
|
||||
of developers have helped make the HTML5 Boilerplate what it is today.
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 2.0 KiB |
BIN
apple-touch-icon-144x144-precomposed.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 640 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 747 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 640 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 640 B After Width: | Height: | Size: 1.1 KiB |
766
build/build.xml
@@ -1,766 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Boilerplate Build" default="build" basedir="../"> <!-- one back since we're in build/ -->
|
||||
|
||||
|
||||
<!-- Load in Ant-Contrib to give us access to some very useful tasks! -->
|
||||
<!-- the .jar file is located in the tools directory -->
|
||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/build/tools/ant-contrib-1.0b3.jar"/>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<!-- load shell environment -->
|
||||
<property environment="ENV" />
|
||||
|
||||
<!-- load property files -->
|
||||
<property file="build/config/project.properties"/>
|
||||
<property file="build/config/default.properties"/>
|
||||
|
||||
<!-- merge the stylesheet properties -->
|
||||
<var name="stylesheet-files" value="${file.stylesheets}, ${file.default.stylesheets}"/>
|
||||
|
||||
<!-- merge the pages properties -->
|
||||
<var name="page-files" value="${file.pages}, ${file.pages.default.include}"/>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
*************************************************
|
||||
* BASE TARGETS *
|
||||
*************************************************
|
||||
-->
|
||||
<target name="basics">
|
||||
<if>
|
||||
<equals arg1="${env}" arg2="dev"/>
|
||||
<then>
|
||||
<!-- Build a dev environment -->
|
||||
<echo message="Building a Development Environment..."/>
|
||||
<antcall target="-basics.dev"/>
|
||||
</then>
|
||||
|
||||
<elseif>
|
||||
<equals arg1="${env}" arg2="test"/>
|
||||
<then>
|
||||
<!-- Build a test environment -->
|
||||
<echo message="Building a Test Environment..."/>
|
||||
<antcall target="-basics.test"/>
|
||||
</then>
|
||||
</elseif>
|
||||
|
||||
<else>
|
||||
<!-- Build a production environment -->
|
||||
<echo message="Building a Production Environment..."/>
|
||||
<antcall target="-basics.production"/>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="text">
|
||||
<if>
|
||||
<equals arg1="${env}" arg2="dev"/>
|
||||
<then>
|
||||
<!-- Build a dev environment -->
|
||||
<echo message="Building a Development Environment..."/>
|
||||
<antcall target="-text.dev"/>
|
||||
</then>
|
||||
|
||||
<elseif>
|
||||
<equals arg1="${env}" arg2="test"/>
|
||||
<then>
|
||||
<!-- Build a test environment -->
|
||||
<echo message="Building a Test Environment..."/>
|
||||
<antcall target="-text.test"/>
|
||||
</then>
|
||||
</elseif>
|
||||
|
||||
<else>
|
||||
<!-- Build a production environment -->
|
||||
<echo message="Building a Production Environment..."/>
|
||||
<antcall target="-text.production"/>
|
||||
</else>
|
||||
</if>
|
||||
<!-- funky order due to jpegtran being a jerk. See comment at top of imagesjpg task -->
|
||||
<antcall target="-jpgcopy"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="buildkit">
|
||||
<if>
|
||||
<equals arg1="${env}" arg2="dev"/>
|
||||
<then>
|
||||
<!-- Build a dev environment -->
|
||||
<echo message="Building a Development Environment..."/>
|
||||
<antcall target="-buildkit.dev"/>
|
||||
</then>
|
||||
|
||||
<elseif>
|
||||
<equals arg1="${env}" arg2="test"/>
|
||||
<then>
|
||||
<!-- Build a test environment -->
|
||||
<echo message="Building a Test Environment..."/>
|
||||
<antcall target="-buildkit.test"/>
|
||||
</then>
|
||||
</elseif>
|
||||
|
||||
<else>
|
||||
<!-- Build a production environment -->
|
||||
<echo message="Building a Production Environment..."/>
|
||||
<antcall target="-buildkit.production"/>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build">
|
||||
<if>
|
||||
<equals arg1="${env}" arg2="dev"/>
|
||||
<then>
|
||||
<!-- Build a dev environment -->
|
||||
<echo message="Building a Development Environment..."/>
|
||||
<antcall target="-build.dev" />
|
||||
</then>
|
||||
|
||||
<elseif>
|
||||
<equals arg1="${env}" arg2="test"/>
|
||||
<then>
|
||||
<!-- Build a test environment -->
|
||||
<echo message="Building a Test Environment..."/>
|
||||
<antcall target="-build.test" />
|
||||
</then>
|
||||
</elseif>
|
||||
|
||||
<else>
|
||||
<!-- Build a production environment -->
|
||||
<echo message="Building a Production Environment..."/>
|
||||
<antcall target="-build.production" />
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="minify">
|
||||
<if>
|
||||
<equals arg1="${env}" arg2="dev"/>
|
||||
<then>
|
||||
<!-- Build a dev environment -->
|
||||
<echo message="Building a Development Environment..."/>
|
||||
<antcall target="-minify.dev"/>
|
||||
</then>
|
||||
|
||||
<elseif>
|
||||
<equals arg1="${env}" arg2="test"/>
|
||||
<then>
|
||||
<!-- Build a test environment -->
|
||||
<echo message="Building a Test Environment..."/>
|
||||
<antcall target="-minify.test"/>
|
||||
</then>
|
||||
</elseif>
|
||||
|
||||
<else>
|
||||
<!-- Build a production environment -->
|
||||
<echo message="Building a Production Environment..."/>
|
||||
<antcall target="-minify.production"/>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
|
||||
<!--
|
||||
*************************************************
|
||||
* BUILD TARGETS *
|
||||
*************************************************
|
||||
-->
|
||||
|
||||
<!-- Target: basics -->
|
||||
<target name="-basics.dev"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy"/>
|
||||
|
||||
<target name="-basics.test"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-css,
|
||||
-html"/>
|
||||
|
||||
<target name="-basics.production"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-strip-console.log,
|
||||
-css,
|
||||
-html"/>
|
||||
|
||||
<!-- Target: text -->
|
||||
<target name="-text.dev"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy"/>
|
||||
|
||||
<target name="-text.test"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-css,
|
||||
-html,
|
||||
-htmlclean"/>
|
||||
|
||||
<target name="-text.production"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-strip-console.log,
|
||||
-css,
|
||||
-html,
|
||||
-htmlclean"/>
|
||||
|
||||
<!-- Target: buildkit -->
|
||||
<target name="-buildkit.dev"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<target name="-buildkit.test"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-css,
|
||||
-html,
|
||||
-htmlbuildkit,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<target name="-buildkit.production"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-strip-console.log,
|
||||
-css,
|
||||
-html,
|
||||
-htmlbuildkit,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<!-- Target: build -->
|
||||
<target name="-build.dev"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<target name="-build.test"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-css,
|
||||
-html,
|
||||
-htmlclean,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<target name="-build.production"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-strip-console.log,
|
||||
-css,
|
||||
-html,
|
||||
-htmlclean,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<!-- Target: minify -->
|
||||
<target name="-minify.dev"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<target name="-minify.test"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-css,
|
||||
-html,
|
||||
-htmlcompress,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<target name="-minify.production"
|
||||
depends="-rev,
|
||||
-clean,
|
||||
-copy,
|
||||
-usemin,
|
||||
-js.all.minify,
|
||||
-js.main.concat,
|
||||
-js.mylibs.concat,
|
||||
-js.scripts.concat,
|
||||
-js.delete,
|
||||
-strip-console.log,
|
||||
-css,
|
||||
-html,
|
||||
-htmlcompress,
|
||||
-imagespng,
|
||||
-imagesjpg"/>
|
||||
|
||||
<!--
|
||||
*************************************************
|
||||
* FUNCTION TARGETS *
|
||||
*************************************************
|
||||
-->
|
||||
<target name="-load-build-info" description="(PRIVATE) Loads the build versioning information">
|
||||
<property file="./${dir.build}/config/${build.version.info}"/>
|
||||
</target>
|
||||
|
||||
<target name="-clean" description="(PRIVATE) Wipe the previous build (Deletes the dir.publish directory">
|
||||
<!-- This is a private target -->
|
||||
|
||||
<echo message="Cleaning up previous build directory..."/>
|
||||
<delete dir="./${dir.publish}/"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-rev" description="(PRIVATE) Increase the current build number by one and set build date">
|
||||
<!-- This is a private target -->
|
||||
|
||||
<echo message="Increasing the build number..."/>
|
||||
<propertyfile file="./${dir.build}/config/${build.version.info}" comment="Build Information File - DO NOT CHANGE">
|
||||
<entry key="build.number" type="int" default="0000" operation="+" pattern="0000"/>
|
||||
<entry key="build.date" type="date" value="now" pattern="dd.MM.yyyy HH:mm"/>
|
||||
</propertyfile>
|
||||
<property file="./${dir.build}/config/${build.version.info}"/>
|
||||
<echo>Creating build ${build.number}</echo>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="current-number" depends="-load-build-info" description="(PUBLIC) Returns the current build number">
|
||||
<echo>Current build number: ${build.number}</echo>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-copy" depends="-load-build-info">
|
||||
<!-- This is a private target -->
|
||||
|
||||
<echo message="Copying over new files..."/>
|
||||
<!-- combine the 2 exclude properties -->
|
||||
<var name="excluded-files" value="${file.default.exclude}, ${file.exclude}"/>
|
||||
|
||||
<copy todir="./${dir.publish}">
|
||||
<fileset dir="${dir.source}/" excludes="${excluded-files}"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<target name="-js.main.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js">
|
||||
<echo message="Concatenating Main JS scripts..."/>
|
||||
<concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.js">
|
||||
<fileset dir="./${dir.publish}/">
|
||||
<include name="**/${dir.js.main}/*.min.js"/>
|
||||
<exclude name="**/${dir.js.mylibs}/*.js"/>
|
||||
<exclude name="**/${dir.js.libs}/*.js"/>
|
||||
</fileset>
|
||||
</concat>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-js.mylibs.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js.mylibs">
|
||||
<echo message="Concatenating JS libraries"/>
|
||||
<concat destfile="./${dir.publish}/${dir.js}/libs-${build.number}.js">
|
||||
<fileset dir="./${dir.publish}/${dir.js.mylibs}/">
|
||||
<include name="**/*.min.js"/>
|
||||
</fileset>
|
||||
</concat>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-js.scripts.concat" depends="-load-build-info" if="build.concat.scripts">
|
||||
<echo message="Concatenating library file with main script file"/>
|
||||
<concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.min.js">
|
||||
<fileset dir="./${dir.publish}/${dir.js}/">
|
||||
<include name="libs-${build.number}.js"/>
|
||||
<include name="scripts-${build.number}.js"/>
|
||||
</fileset>
|
||||
</concat>
|
||||
|
||||
<echo message="Concatenating library file with main debug script file"/>
|
||||
<concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.min.js">
|
||||
<fileset dir="./${dir.publish}/${dir.js}/">
|
||||
<include name="libs-${build.number}.js"/>
|
||||
<include name="scripts-${build.number}-debug.js"/>
|
||||
</fileset>
|
||||
</concat>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-js.all.minify" depends="-js.libs.minify" description="(PRIVATE) Minifies the scripts.js files created by js.scripts.concat">
|
||||
<echo message="Minifying concatenated script- and library-file"/>
|
||||
<apply executable="java" parallel="false">
|
||||
<fileset dir="./${dir.publish}/${dir.js}">
|
||||
<include name="**/*.js"/>
|
||||
<exclude name="**/*.min.js"/>
|
||||
<exclude name="**/${dir.js.libs}/*.js"/>
|
||||
</fileset>
|
||||
<arg line="-jar"/>
|
||||
<arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
|
||||
<srcfile/>
|
||||
<arg line="--line-break"/>
|
||||
<arg line="4000"/>
|
||||
<arg line="-o"/>
|
||||
<mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js}/*.min.js"/>
|
||||
<targetfile/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-js.libs.minify" depends="-load-build-info" description="(PRIVATE) Minifies the helper files in dir.js.libs">
|
||||
<echo message="Minifying helper JS files..."/>
|
||||
|
||||
<apply executable="java" parallel="false">
|
||||
<fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
|
||||
<arg line="-jar"/>
|
||||
<arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
|
||||
<srcfile/>
|
||||
<arg line="-o"/>
|
||||
<mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js.libs}/*-${build.number}.min.js"/>
|
||||
<targetfile/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-js.delete" depends="-load-build-info" description="(PRIVATE) Deletes the unoptimized js files from build if set">
|
||||
<if>
|
||||
<equals arg1="${build.delete.unoptimized}" arg2="true"/>
|
||||
<then>
|
||||
<echo message="Deleting unoptimized files..."/>
|
||||
<delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
|
||||
<delete file="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.js"/>
|
||||
<!--
|
||||
<delete dir="./${dir.publish}/${dir.js.lib}/"/>
|
||||
<delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
|
||||
this guy probably COULD be on but I think it's better if we keep him off for now. ^pi
|
||||
<delete includeemptydirs="true">
|
||||
<fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
|
||||
</delete>
|
||||
-->
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<and>
|
||||
<equals arg1="${build.delete.unoptimized}" arg2="true"/>
|
||||
<equals arg1="${build.concat.scripts}" arg2="true"/>
|
||||
</and>
|
||||
<then>
|
||||
<delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
|
||||
<delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-strip-console.log" description="(PRIVATE)Comments out any console.log statements">
|
||||
<echo message="Commenting out console.log lines"/>
|
||||
|
||||
|
||||
<replaceregexp match="(console.log\(.*\))" replace="/\*\1\*/" flags="g" >
|
||||
<fileset dir="./${dir.publish}/${dir.js}/">
|
||||
<include name="**/*.js"/>
|
||||
<exclude name="**/*.min.js"/>
|
||||
</fileset>
|
||||
</replaceregexp>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- HTML -->
|
||||
<target name="-usemin" depends="-serverconfig" description="(PRIVATE) Replaces references to non-minified scripts">
|
||||
<echo message="Switching to minified js files..."/>
|
||||
|
||||
<!-- switch from a regular jquery to minified -->
|
||||
<replaceregexp match="jquery-(\d|\d(\.\d)+)\.js" replace="jquery-\1.min.js" flags="">
|
||||
<fileset dir="./${dir.publish}" includes="${page-files}"/>
|
||||
</replaceregexp>
|
||||
<!-- switch any google CDN reference to minified -->
|
||||
<replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" flags="">
|
||||
<fileset dir="./${dir.publish}" includes="${page-files}"/>
|
||||
</replaceregexp>
|
||||
|
||||
<echo>kill off those versioning flags: ?v=2</echo>
|
||||
<replaceregexp match='\?v=\d+">' replace='">' flags="">
|
||||
<fileset dir="./${dir.publish}" includes="${page-files}"/>
|
||||
</replaceregexp>
|
||||
|
||||
<echo>remove favicon reference if it is pointing to the root</echo>
|
||||
<replaceregexp match="<link rel="shortcut icon" href="/favicon\.ico">" replace="">
|
||||
<fileset dir="./${dir.publish}" includes="${page-files}"/>
|
||||
</replaceregexp>
|
||||
<!-- we maintain the apple-touch-icon reference for Android 2.2 www.ravelrumba.com/blog/android-apple-touch-icon
|
||||
<replace token="<link rel="apple-touch-icon" href="/apple-touch-icon.png">" value="">
|
||||
<fileset dir="./${dir.publish}" includes="${page-files}"/>
|
||||
</replace>
|
||||
-->
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-html" depends="-load-build-info" description="(PRIVATE) Very basic clean up of the HTML">
|
||||
<echo message="Clean up the html..."/>
|
||||
<!-- style.css replacement handled as a replacetoken above -->
|
||||
<replaceregexp match="<!-- scripts concatenated [\d\w\s\W]*?!-- end ((scripts)|(concatenated and minified scripts))-->" replace="<script src='${dir.js}/scripts-${build.number}.min.js\'></script>" flags="m">
|
||||
<fileset dir="./${dir.publish}" includes="${page-files}"/>
|
||||
</replaceregexp>
|
||||
<!--[! use comments like this one to avoid having them get minified -->
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-htmlclean">
|
||||
<apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
|
||||
<fileset dir="./${dir.publish}/" includes="${page-files}"/>
|
||||
<arg value="-jar"/>
|
||||
<arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
|
||||
<arg line="--type html"/>
|
||||
<arg line="--preserve-multi-spaces"/>
|
||||
<arg line="--remove-quotes"/>
|
||||
<arg line="--compress-js"/>
|
||||
<arg line="--compress-css"/>
|
||||
<srcfile/>
|
||||
<arg value="-o"/>
|
||||
<mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
|
||||
<targetfile/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-htmlbuildkit">
|
||||
<apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
|
||||
<fileset dir="./${dir.publish}/" includes="${page-files}"/>
|
||||
<arg value="-jar"/>
|
||||
<arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
|
||||
<arg value="--preserve-comments"/>
|
||||
<arg line="--preserve-multi-spaces"/>
|
||||
<arg line="--type html"/>
|
||||
<arg line="--compress-js"/>
|
||||
<arg line="--compress-css"/>
|
||||
<srcfile/>
|
||||
<arg value="-o"/>
|
||||
<mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
|
||||
<targetfile/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-htmlcompress">
|
||||
<apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
|
||||
<fileset dir="./${dir.publish}/" includes="${page-files}"/>
|
||||
<arg value="-jar"/>
|
||||
<arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
|
||||
<arg line="--type html"/>
|
||||
<arg line="--remove-quotes"/>
|
||||
<arg line="--compress-js"/>
|
||||
<arg line="--compress-css"/>
|
||||
<srcfile/>
|
||||
<arg value="-o"/>
|
||||
<mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
|
||||
<targetfile/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-serverconfig" description="(PRIVATE) Upgrades expires headers">
|
||||
<echo message="Upgrading expires header timeouts for js/css"/>
|
||||
<replace file="./${dir.publish}/${file.serverconfig}" token="access plus 2 months" value="access plus 1 year"/>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- CSS -->
|
||||
<target name="-css" depends="-load-build-info" description="Concatenates and Minifies any stylesheets listed in the file.stylesheets property">
|
||||
<echo message="Minifying css..."/>
|
||||
|
||||
<concat destfile="./${dir.publish}/${dir.css}/style-${build.number}.css">
|
||||
<filelist dir="./${dir.publish}/${dir.css}" files="${stylesheet-files}"/>
|
||||
</concat>
|
||||
<apply executable="php" parallel="false">
|
||||
<fileset dir="./${dir.publish}/${dir.css}/" includes="style-${build.number}.css"/>
|
||||
<arg line="-f"/>
|
||||
<arg path="./${dir.build.tools}/${tool.csscompressor}"/>
|
||||
<srcfile/>
|
||||
<redirector>
|
||||
<outputmapper type="glob" from="style-${build.number}.css" to="./${dir.publish}/${dir.css}/style-${build.number}.min.css"/>
|
||||
</redirector>
|
||||
</apply>
|
||||
|
||||
<replace token="style.css" value="style-${build.number}.min.css" dir="${dir.publish}" includes="${page-files}"/>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- IMAGES -->
|
||||
<target name="-imagespng" description="(PRIVATE) Optimizes .png images using optipng">
|
||||
<echo message="Optimizing images..."/>
|
||||
<echo message="This part might take a while. But the rest of everything is already done."/>
|
||||
<echo message="First, we run optipng on the .png files..."/>
|
||||
|
||||
<!-- osfamily=unix is actually true on OS X as well -->
|
||||
<!-- On *nix's and OS X, check for optipng and give a helpful message if it's not installed -->
|
||||
<if>
|
||||
<and>
|
||||
<os family="unix" />
|
||||
<available file="optipng" filepath="${ENV.PATH}" />
|
||||
</and>
|
||||
<then>
|
||||
<apply executable="optipng" osfamily="unix">
|
||||
<arg value="-quiet"/>
|
||||
<arg value="-o7"/>
|
||||
<fileset dir="./${dir.publish}/">
|
||||
<include name="**/*.png"/>
|
||||
</fileset>
|
||||
</apply>
|
||||
</then>
|
||||
<elseif>
|
||||
<os family="unix" />
|
||||
<then>
|
||||
<echo message="*** optipng NOT INSTALLED. SKIPPING OPTIMIZATION OF PNGs." />
|
||||
<echo message="*** Install optipng to enable png optimization." />
|
||||
<echo message="*** For instructions see 'Dependencies' at: http://html5boilerplate.com/docs/#Build-script#dependencies" />
|
||||
</then>
|
||||
</elseif>
|
||||
</if>
|
||||
|
||||
<apply executable="tools/optipng-0.6.4-exe/optipng.exe" osfamily="windows">
|
||||
<arg value="-o7"/>
|
||||
<arg value="-quiet"/>
|
||||
<fileset dir="./${dir.publish}/">
|
||||
<include name="**/*.png"/>
|
||||
</fileset>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-imagesjpg" description="(PRIVATE) Optimizes .jpg images using jpegtan">
|
||||
<echo message="Now, we clean up those jpgs..."/>
|
||||
|
||||
<!-- jpegtran is a little weird in that it assumes a pre-existing file means it's already optimized. -->
|
||||
<!-- why? good question. To combat this, we skipped copying over the ${dir.images}/*.jpg earlier in the -->
|
||||
<!-- copy task. Now, we're using jpegtran to copy the files over while we crunch 'em. -->
|
||||
|
||||
<if>
|
||||
<equals arg1="${images.strip.metadata}" arg2="true"/>
|
||||
<then>
|
||||
<var name="strip-meta-tags" value="none"/>
|
||||
</then>
|
||||
<else>
|
||||
<var name="strip-meta-tags" value="all"/>
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- On *nix's and OS X, check for jpegtran and give a helpful message if it's not installed -->
|
||||
<if>
|
||||
<and>
|
||||
<os family="unix" />
|
||||
<available file="jpegtran" filepath="${ENV.PATH}" />
|
||||
</and>
|
||||
<then>
|
||||
<apply executable="jpegtran" osfamily="unix">
|
||||
<fileset dir="./${dir.images}" includes="*.jpg"/>
|
||||
<arg value="-copy"/>
|
||||
<arg value="${strip-meta-tags}"/>
|
||||
<arg value="-optimize"/>
|
||||
<srcfile/>
|
||||
<redirector>
|
||||
<outputmapper type="glob" from="*.jpg" to="./${dir.publish}/${dir.images}/*.jpg"/>
|
||||
</redirector>
|
||||
<!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
|
||||
</apply>
|
||||
</then>
|
||||
<elseif>
|
||||
<os family="unix" />
|
||||
<then>
|
||||
<echo message="*** jpegtran NOT INSTALLED. SKIPPING OPTIMIZATION OF JPEGs." />
|
||||
<echo message="*** Install jpegtran to enable jpeg optimization." />
|
||||
<echo message="*** For instructions see 'Dependencies' at: http://html5boilerplate.com/docs/#Build-script#dependencies" />
|
||||
</then>
|
||||
</elseif>
|
||||
</if>
|
||||
|
||||
<apply executable="tools/jpegtran.exe" osfamily="windows">
|
||||
<fileset dir="./${dir.images}" includes="*.jpg"/>
|
||||
<arg value="-copy"/>
|
||||
<arg value="${strip-meta-tags}"/>
|
||||
<arg value="-optimize"/>
|
||||
<srcfile/>
|
||||
<targetfile/>
|
||||
<!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
|
||||
<mapper type="glob" from="*.jpg" to="../${dir.publish}/${dir.images}/*.jpg"/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="-jpgcopy">
|
||||
<echo message="Copying over the unmodified jpegs."/>
|
||||
|
||||
<copy todir="./${dir.publish}/${dir.images}">
|
||||
<fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -1,3 +0,0 @@
|
||||
# build.properties file defines overrides for default.properties
|
||||
# Explanation: This file should be created by each user as and when he or she needs to override particular values.
|
||||
# Consequently, it should not be placed under version control.
|
||||
@@ -1,80 +0,0 @@
|
||||
#
|
||||
# Default Build Settings
|
||||
# you can override these settings on a project basis in a project.properties file
|
||||
# so probably best not to touch these as they could be overwritten in later versions!
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Directory Paths
|
||||
#
|
||||
dir.source = .
|
||||
dir.publish = publish
|
||||
dir.build = build
|
||||
dir.build.tools = ${dir.build}/tools
|
||||
dir.test = test
|
||||
dir.demo = demo
|
||||
dir.js = js
|
||||
dir.js.main = ${dir.js}
|
||||
# scripts in the lib direcotry will only be minified, not concatenated together
|
||||
dir.js.libs = ${dir.js}/libs
|
||||
dir.js.mylibs = ${dir.js}/mylibs
|
||||
dir.css = css
|
||||
dir.images = img
|
||||
|
||||
|
||||
#
|
||||
# HTML, PHP, etc files to clean and update script/css references
|
||||
#
|
||||
file.pages.default.include = index.html, 404.html
|
||||
|
||||
# You will need to include the property file.pages.include in your project.properties file
|
||||
# and add any extra pages you want to be updated by the scripts in a comma separated lis
|
||||
|
||||
|
||||
# the server configuration you're going with. If you don't use apache,
|
||||
# get a different one here: github.com/paulirish/html5-boilerplate-server-configs
|
||||
|
||||
file.serverconfig = .htaccess
|
||||
|
||||
#
|
||||
# Files not to be copied over by the script to the publish directory
|
||||
#
|
||||
file.default.exclude = .gitignore, .project, .settings, README.markdown, README.md, ${dir.images}/*.jpg, **/.git/**, **/.svn/**, **/${dir.build}/**, **/${dir.test}/**, **/${dir.demo}/**
|
||||
|
||||
# Declare the file.exclude property in your project.properties file if you want to exclude files / folders you have added
|
||||
# Note: you cannot decalre an empty file.exclude property
|
||||
|
||||
|
||||
#
|
||||
# Default Styleshee
|
||||
#
|
||||
file.default.stylesheets = style.css
|
||||
|
||||
#
|
||||
# Script Optimisation
|
||||
#
|
||||
# If set, concat libraries with main scripts file, producing single script file
|
||||
build.concat.scripts = true
|
||||
# If set, delete minified but unconcatted files.
|
||||
build.delete.unoptimized = true
|
||||
|
||||
|
||||
#
|
||||
# Image Optimisation
|
||||
#
|
||||
images.strip.metadata = true
|
||||
# Seting this to true will strip the metadata from all jpeg files.
|
||||
# YOU SHOULD ONLY DO THIS IF YOU OWN THE COPYRIGHT TO ALL THE IMAGES IN THE BUILD
|
||||
|
||||
|
||||
# Build Info
|
||||
build.version.info = buildinfo.properties
|
||||
build.scripts.dir = ${dir.build}/build-scripts
|
||||
|
||||
# Tools
|
||||
tool.yuicompressor = yuicompressor-2.4.2.jar
|
||||
tool.htmlcompressor = htmlcompressor-0.9.9.jar
|
||||
tool.csscompressor = css-compressor/cli.php
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
# project.properties file defines overrides for default.properties
|
||||
# Explanation: This file should be created by each user as and when he or she needs to override particular values.
|
||||
# Consequently, it should not be placed under version control.
|
||||
|
||||
|
||||
# Stylesheets
|
||||
#
|
||||
# Note: Stylesheets will be concatenated in the order they are listed in the file.stylesheets property (i.e. the las
|
||||
# file listed will be at the end of the concatenated file), so it probably makes sense to have the main style.css file
|
||||
# as the first entry
|
||||
# Example:
|
||||
# file.stylesheets = style.css, lightbox.css, plugin.css
|
||||
#
|
||||
file.stylesheets =
|
||||
|
||||
|
||||
# Web Pages
|
||||
#
|
||||
# These are the pages (files) that will be served to users (.html, .php, .asp, etc). Files in this property will
|
||||
# be minified / optimised and have any stylesheet or javascript references updated to the minified examples
|
||||
#
|
||||
# The paths need to be relative
|
||||
#
|
||||
# Files can be added in a comma separated form
|
||||
file.pages =
|
||||
|
||||
|
||||
|
||||
# Excluded files and dirs
|
||||
#
|
||||
# Add any files or directories you add to the project and do not want to be copied to the publish directory as a
|
||||
# comma separated lis
|
||||
# These files are ignored in addition to the default ones specified in default.properties.
|
||||
file.exclude =
|
||||
|
||||
|
||||
# Specify an environment to build
|
||||
#
|
||||
# By Default, it builds a production environmen
|
||||
# Set to dev if buidling a development environmen
|
||||
# Set to test if building a test environmen
|
||||
env =
|
||||
|
||||
|
||||
# Directory Structure
|
||||
#
|
||||
# Override any directory paths specific to this projec
|
||||
#
|
||||
# dir.publish
|
||||
# dir.js
|
||||
# dir.js.libs
|
||||
# dir.js.mylibs
|
||||
# dir.css
|
||||
# dir.images
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#Generate a new project from your HTML5 Boilerplate repo clone
|
||||
#Created 2010-10-13, Rick Waldron
|
||||
|
||||
|
||||
##first run
|
||||
# $ cd html5-boilerplate/build
|
||||
# $ chmod +x createproject.sh && ./createproject.sh
|
||||
|
||||
##usage
|
||||
# $ cd html5-boilerplate/build
|
||||
# $ ./createproject.sh
|
||||
|
||||
# find project root (also ensure script is ran from within repo)
|
||||
src=$(git rev-parse --show-toplevel) || exit 1
|
||||
|
||||
# get a name for new project
|
||||
while [[ -z $name ]]
|
||||
do
|
||||
echo "To create a new html5-boilerplate project, enter a new directory name:"
|
||||
read name || exit
|
||||
done
|
||||
dst=$src/../$name
|
||||
|
||||
if [[ -d $dst ]]
|
||||
then
|
||||
echo "$dst exists"
|
||||
else
|
||||
#create new project
|
||||
mkdir "$dst" || exit 1
|
||||
|
||||
#sucess message
|
||||
echo "Created Directory: $dst"
|
||||
|
||||
cd "$src"
|
||||
cp -vr css/ js/ img/ *.html *.xml *.txt *.png *.ico .htaccess "$dst"
|
||||
|
||||
#sucess message
|
||||
echo "Created Project: $dst"
|
||||
fi
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# This is for windows users only.
|
||||
# If you're on a mac or linux, just run `ant build` from this folder in Terminal
|
||||
|
||||
set MYDIR=%~dp0
|
||||
ant build
|
||||
@@ -1,465 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
// Static dependencies, Subclasses loaded ondemand
|
||||
require( dirname(__FILE__) . '/lib/Exception.php' );
|
||||
require( dirname(__FILE__) . '/lib/Control.php' );
|
||||
|
||||
|
||||
Class CSSCompression
|
||||
{
|
||||
/**
|
||||
* CSSCompression Info
|
||||
*
|
||||
* @const (string) VERSION: Release version
|
||||
* @const (string) DATE: Release date
|
||||
*/
|
||||
const VERSION = "[VERSION]";
|
||||
const DATE = "[DATE]";
|
||||
|
||||
/**
|
||||
* WARNING: This should ALWAYS BE FALSE in production
|
||||
* When DEV is true, backdoor access to private methods is opened.
|
||||
* Only used for unit testing and development.
|
||||
*/
|
||||
const DEV = true;
|
||||
|
||||
/**
|
||||
* TOKEN is a special string that gets used as a marker within
|
||||
* the compressor, and is removed before final output. Make sure
|
||||
* this token is unique to your stylsheets.
|
||||
*
|
||||
* NOTE: This string gets used in regular expressions, and escaping
|
||||
* won't help, so don't pick a complicated token.
|
||||
*/
|
||||
const TOKEN = "@____CSSCOMPRESSION_TOKEN____@";
|
||||
|
||||
/**
|
||||
* The default set of options for every instance.
|
||||
*/
|
||||
public static $defaults = array(
|
||||
// Converts long color names to short hex names
|
||||
// (aliceblue -> #f0f8ff)
|
||||
'color-long2hex' => true,
|
||||
|
||||
// Converts rgb colors to hex
|
||||
// (rgb(159,80,98) -> #9F5062, rgb(100%) -> #FFFFFF)
|
||||
'color-rgb2hex' => true,
|
||||
|
||||
// Converts long hex codes to short color names (#f5f5dc -> beige)
|
||||
// Only works on latest browsers, careful when using
|
||||
'color-hex2shortcolor' => false,
|
||||
|
||||
// Converts long hex codes to short hex codes
|
||||
// (#44ff11 -> #4f1)
|
||||
'color-hex2shorthex' => true,
|
||||
|
||||
// Converts hex codes to safe CSS Level 1 color names
|
||||
// (#F00 -> red)
|
||||
'color-hex2safe' => true,
|
||||
|
||||
// Converts font-weight names to numbers
|
||||
// (bold -> 700)
|
||||
'fontweight2num' => true,
|
||||
|
||||
// Removes zero decimals and 0 units
|
||||
// (15.0px -> 15px || 0px -> 0)
|
||||
'format-units' => true,
|
||||
|
||||
// Lowercases html tags from list
|
||||
// (BODY -> body)
|
||||
'lowercase-selectors' => true,
|
||||
|
||||
// Converts id and class attribute selectors, to their short selector counterpart
|
||||
// (div[id=blah][class=moreblah] -> div#blah.moreblah)
|
||||
'attr2selector' => true,
|
||||
|
||||
// Promotes nested id's to the front of the selector
|
||||
// (body>div#elem p -> $elem p)
|
||||
'strict-id' => false,
|
||||
|
||||
// Add space after pseudo selectors, for ie6
|
||||
// (a:first-child{ -> a:first-child {)
|
||||
'pseudo-space' => false,
|
||||
|
||||
// Compresses single defined multi-directional properties
|
||||
// (margin: 15px 25px 15px 25px -> margin:15px 25px)
|
||||
'directional-compress' => true,
|
||||
|
||||
// Combines multiply defined selectors and details
|
||||
// (p{color:blue;} p{font-size:12pt} -> p{color:blue;font-size:12pt;})
|
||||
// (p{color:blue;} a{color:blue;} -> p,a{color:blue;})
|
||||
'organize' => true,
|
||||
|
||||
// Combines color/style/width properties
|
||||
// (border-style:dashed;border-color:black;border-width:4px; -> border:4px dashed black)
|
||||
'csw-combine' => true,
|
||||
|
||||
// Combines cue/pause properties
|
||||
// (cue-before: url(before.au); cue-after: url(after.au) -> cue:url(before.au) url(after.au))
|
||||
'auralcp-combine' => true,
|
||||
|
||||
// Combines margin/padding directionals
|
||||
// (margin-top:10px;margin-right:5px;margin-bottom:4px;margin-left:1px; -> margin:10px 5px 4px 1px;)
|
||||
'mp-combine' => true,
|
||||
|
||||
// Combines border directionals
|
||||
// (border-top|right|bottom|left:1px solid black -> border:1px solid black)
|
||||
'border-combine' => true,
|
||||
|
||||
// Combines font properties
|
||||
// (font-size:12pt; font-family: arial; -> font:12pt arial)
|
||||
'font-combine' => true,
|
||||
|
||||
// Combines background properties
|
||||
// (background-color: black; background-image: url(bgimg.jpeg); -> background:black url(bgimg.jpeg))
|
||||
'background-combine' => true,
|
||||
|
||||
// Combines list-style properties
|
||||
// (list-style-type: round; list-style-position: outside -> list-style:round outside)
|
||||
'list-combine' => true,
|
||||
|
||||
// Combines border-radius properties
|
||||
// {
|
||||
// border-top-left-radius: 10px;
|
||||
// border-top-right-radius: 10px;
|
||||
// border-bottom-right-radius: 10px;
|
||||
// border-bottom-left-radius: 10px;
|
||||
// }
|
||||
// -> { border-radius: 10px; }
|
||||
'border-radius-combine' => true,
|
||||
|
||||
// Removes the last semicolon of a property set
|
||||
// ({margin: 2px; color: blue;} -> {margin: 2px; color: blue})
|
||||
'unnecessary-semicolons' => true,
|
||||
|
||||
// Removes multiple declarations within the same rule set
|
||||
'rm-multi-define' => true,
|
||||
|
||||
// Adds all unknown blocks to the top of the output in a comment strip
|
||||
// Purely for bug reporting, but also useful to know what isn't being handled
|
||||
'add-unknown' => true,
|
||||
|
||||
// Readibility of Compressed Output, Defaults to none
|
||||
'readability' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* Modes are predefined sets of configuration for referencing. When creating a mode, all options are set to true,
|
||||
* and the mode array defines which options are to be false
|
||||
*
|
||||
* @mode safe: Safe mode does zero combinations or organizing. It's the best mode if you use a lot of hacks
|
||||
* @mode sane: Sane mode does most combinations(multiple long hand notations to single shorthand),
|
||||
* --- but still keeps most declarations in their place
|
||||
* @mode small: Small mode reorganizes the whole sheet, combines as much as it can, and will break most comment hacks
|
||||
* @mode full: Full mode does everything small does, but also converts hex codes to their short color name alternatives
|
||||
*/
|
||||
private static $modes = array(
|
||||
'safe' => array(
|
||||
'color-hex2shortcolor' => false,
|
||||
'attr2selector' => false,
|
||||
'strict-id' => false,
|
||||
'organize' => false,
|
||||
'csw-combine' => false,
|
||||
'auralcp-combine' => false,
|
||||
'mp-combine' => false,
|
||||
'border-combine' => false,
|
||||
'font-combine' => false,
|
||||
'background-combine' => false,
|
||||
'list-combine' => false,
|
||||
'border-radius-combine' => false,
|
||||
'rm-multi-define' => false,
|
||||
),
|
||||
'sane' => array(
|
||||
'color-hex2shortcolor' => false,
|
||||
'strict-id' => false,
|
||||
'organize' => false,
|
||||
'font-combine' => false,
|
||||
'background-combine' => false,
|
||||
'list-combine' => false,
|
||||
'rm-multi-define' => false,
|
||||
),
|
||||
'small' => array(
|
||||
'color-hex2shortcolor' => false,
|
||||
'pseudo-space' => false,
|
||||
),
|
||||
'full' => array(
|
||||
'pseudo-space' => false,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Readability Constants
|
||||
*
|
||||
* @param (int) READ_MAX: Maximum readability of output
|
||||
* @param (int) READ_MED: Medium readability of output
|
||||
* @param (int) READ_MIN: Minimal readability of output
|
||||
* @param (int) READ_NONE: No readability of output (full compression into single line)
|
||||
*/
|
||||
const READ_MAX = 3;
|
||||
const READ_MED = 2;
|
||||
const READ_MIN = 1;
|
||||
const READ_NONE = 0;
|
||||
|
||||
/**
|
||||
* Static Helpers
|
||||
*
|
||||
* @instance express: Use a separate instance from singleton access
|
||||
* @instance instance: Saved instance of CSSCompression
|
||||
* @param (array) instances: Array of stored instances
|
||||
* @param (array) rjson: Comment removal before json decoding
|
||||
*/
|
||||
private static $express;
|
||||
private static $instance;
|
||||
private static $instances = array();
|
||||
private static $rjson = array(
|
||||
'patterns' => array(
|
||||
"/^(.*?){/s",
|
||||
"/(\t|\s)+\/\/.*/",
|
||||
),
|
||||
'replacements' => array(
|
||||
'{',
|
||||
'',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Controller Instance
|
||||
*/
|
||||
private $Control;
|
||||
|
||||
/**
|
||||
* Builds the subclasses, runs the compression if css passed, and merges options
|
||||
*
|
||||
* @param (string) css: CSS to compress on initialization if needed
|
||||
* @param (array) options: Array of preferences to override the defaults
|
||||
*/
|
||||
public function __construct( $css = NULL, $options = NULL ) {
|
||||
$this->Control = new CSSCompression_Control( $this );
|
||||
|
||||
// Autorun against css passed
|
||||
if ( $css ) {
|
||||
// Allow passing options/mode only
|
||||
if ( is_array( $css ) || array_key_exists( $css, self::$modes ) ) {
|
||||
$this->Control->Option->merge( $css );
|
||||
}
|
||||
else {
|
||||
$this->Control->compress( $css, $options );
|
||||
}
|
||||
}
|
||||
// Merge passed options
|
||||
else if ( $options ) {
|
||||
$this->Control->Option->merge( $options );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (Proxy function) Control access to properties
|
||||
*
|
||||
* - Getting stats/_mode/css returns the current value of that property
|
||||
* - Getting options will return the current full options array
|
||||
* - Getting anything else returns that current value in the options array or NULL
|
||||
*
|
||||
* @param (string) name: Name of property that you want to access
|
||||
*/
|
||||
public function __get( $name ) {
|
||||
return $this->Control->get( $name );
|
||||
}
|
||||
|
||||
/**
|
||||
* (Proxy function) The setter method only allows
|
||||
* access to setting values in the options array
|
||||
*
|
||||
* @param (string) name: Key name of the option you want to set
|
||||
* @param (mixed) value: Value of the option you want to set
|
||||
*/
|
||||
public function __set( $name, $value ) {
|
||||
return $this->Control->set( $name, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* (Proxy function) Merges a predefined set options
|
||||
*
|
||||
* @param (string) mode: Name of mode to use.
|
||||
*/
|
||||
public function mode( $mode = NULL ) {
|
||||
return $this->Control->Option->merge( $mode );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new mode, or overwrites existing mode
|
||||
*
|
||||
* @param (mixed) mode: Name of the mode, or array of modes
|
||||
* @param (array) config: Configuration of the mode
|
||||
*/
|
||||
public static function modes( $mode = NULL, $config = NULL ) {
|
||||
if ( $mode === NULL ) {
|
||||
return self::$modes;
|
||||
}
|
||||
else if ( is_array( $mode ) ) {
|
||||
return array_merge( self::$modes, $mode );
|
||||
}
|
||||
else if ( $config === NULL ) {
|
||||
return isset( self::$modes[ $mode ] ) ? self::$modes[ $mode ] : NULL;
|
||||
}
|
||||
else {
|
||||
return self::$modes[ $mode ] = $config;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (Proxy function) Maintainable access to the options array
|
||||
*
|
||||
* - Passing no arguments returns the entire options array
|
||||
* - Passing a single name argument returns the value for the option
|
||||
* - Passing an array will merge the options with the array passed, for object like extension
|
||||
* - Passing both a name and value, sets the value to the name key, and returns the value
|
||||
*
|
||||
* @param (mixed) name: The key name of the option
|
||||
* @param (mixed) value: Value to set the option
|
||||
*/
|
||||
public function option( $name = NULL, $value = NULL ) {
|
||||
return $this->Control->Option->option( $name, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* (Proxy function) Run compression on the sheet passed.
|
||||
*
|
||||
* @param (string) css: Stylesheet to be compressed
|
||||
* @param (mixed) options: Array of options or mode to use.
|
||||
*/
|
||||
public function compress( $css = NULL, $options = NULL ) {
|
||||
return $this->Control->compress( $css, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Static access for direct compression
|
||||
*
|
||||
* @param (string) css: Stylesheet to be compressed
|
||||
* @param (mixed) options: Array of options or mode to use.
|
||||
*/
|
||||
public static function express( $css = NULL, $options = NULL ) {
|
||||
if ( ! self::$express ) {
|
||||
self::$express = new CSSCompression();
|
||||
}
|
||||
|
||||
self::$express->reset();
|
||||
return self::$express->compress( $css, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* (Proxy Function) Cleans out compressor and it's subclasses to defaults
|
||||
*
|
||||
* @params none
|
||||
*/
|
||||
public function reset(){
|
||||
return $this->Control->reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* (Proxy Function) Cleans out class variables for next run
|
||||
*
|
||||
* @params none
|
||||
*/
|
||||
public function flush(){
|
||||
return $this->Control->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Singleton access method (for those that want it)
|
||||
*
|
||||
* @param (string) name: Name of the stored instance
|
||||
*/
|
||||
public static function getInstance( $name = NULL ) {
|
||||
if ( $name !== NULL ) {
|
||||
if ( ! isset( self::$instances[ $name ] ) ) {
|
||||
self::$instances[ $name ] = new self;
|
||||
}
|
||||
|
||||
return self::$instances[ $name ];
|
||||
}
|
||||
else if ( ! self::$instance ) {
|
||||
self::$instance = new self;
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads JOSN based files, strips comments and converts to array
|
||||
*
|
||||
* @param (string) file: Filename
|
||||
*/
|
||||
public static function getJSON( $file ) {
|
||||
// Assume helper file if full path not given
|
||||
$file = $file[ 0 ] == '/' ? $file : dirname(__FILE__) . '/helpers/' . $file;
|
||||
|
||||
// Strip comments
|
||||
$json = preg_replace( self::$rjson['patterns'], self::$rjson['replacements'], file_get_contents( $file ) );
|
||||
|
||||
// Decode json
|
||||
$json = json_decode( $json, true );
|
||||
|
||||
// Check for errors
|
||||
if ( $json === NULL ) {
|
||||
$e = '';
|
||||
// JSON Errors, taken directly from http://php.net/manual/en/function.json-last-error.php
|
||||
switch( json_last_error() ) {
|
||||
case JSON_ERROR_NONE:
|
||||
$e = 'No error has occurred';
|
||||
break;
|
||||
case JSON_ERROR_DEPTH:
|
||||
$e = 'The maximum stack depth has been exceeded';
|
||||
break;
|
||||
case JSON_ERROR_CTRL_CHAR:
|
||||
$e = 'Control character error, possibly incorrectly encoded';
|
||||
break;
|
||||
case JSON_ERROR_STATE_MISMATCH:
|
||||
$e = 'Invalid or malformed JSON';
|
||||
break;
|
||||
case JSON_ERROR_SYNTAX:
|
||||
$e = 'Syntax error';
|
||||
break;
|
||||
case JSON_ERROR_UTF8:
|
||||
$e = 'Malformed UTF-8 characters, possibly incorrectly encoded';
|
||||
break;
|
||||
default:
|
||||
$e = 'Unknown JSON Error';
|
||||
break;
|
||||
}
|
||||
|
||||
throw new CSSCompression_Exception( "JSON Error in $file: $e" );
|
||||
}
|
||||
|
||||
// Good to go
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Backdoor access to subclasses
|
||||
* ONLY FOR DEVELOPMENT/TESTING.
|
||||
*
|
||||
* @param (string) class: Name of the focus class
|
||||
* @param (string) method: Method function to call
|
||||
* @param (array) args: Array of arguments to pass in
|
||||
*/
|
||||
public function access( $class = NULL, $method = NULL, $args = NULL ) {
|
||||
if ( ! self::DEV ) {
|
||||
throw new CSSCompression_Exception( "CSSCompression is not in development mode." );
|
||||
}
|
||||
else if ( $class === NULL || $method === NULL || $args === NULL ) {
|
||||
throw new CSSCompression_Exception( "Invalid Access Call." );
|
||||
}
|
||||
else if ( ! is_array( $args ) ) {
|
||||
throw new CSSCompression_Exception( "Expecting array of arguments." );
|
||||
}
|
||||
|
||||
return $this->Control->access( $class, $method, $args );
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# CSS Compression [VERSION] Change Log
|
||||
# [DATE]
|
||||
# Corey Hart @ http://www.codenothing.com
|
||||
#
|
||||
|
||||
# Compressor Additions
|
||||
- Configuration Modes
|
||||
- pseduo-space, add space between pseduo selectors and comma/brace for ie6
|
||||
- removing leading 0 of a decimal, 0.633px -> .633px
|
||||
- handling all At Rules (charsets,media,imports,font-family,etc..)
|
||||
- handling ms filter paths
|
||||
- More css hacks support, including box-modal hack
|
||||
- attr2selector, Convert id=blah and class=blah attributes to their selector counterparts
|
||||
- strict-id, removes all selectors up to the last id
|
||||
- add-unknown, adds unknown blocks to top of output in a comment
|
||||
|
||||
# Codebase Changes
|
||||
- Converted to subclass architecture, more modular.
|
||||
- Using JSON based sandbox specs for focused unit tests.
|
||||
- Helper conversion definitions(long2hex, hex2short) are now in JSON based files.
|
||||
- Added benchmark/regression testing
|
||||
@@ -1,228 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
require( dirname(__FILE__) . '/CSSCompression.php' );
|
||||
|
||||
|
||||
Class CSSCompression_Cli
|
||||
{
|
||||
/**
|
||||
* Cli Patterns
|
||||
*
|
||||
* @param (CSSCompression instance) instance: CSSCompression instance
|
||||
* @param (array) args: Array of command line arguments
|
||||
* @param (array) options: Array of options read from cli arguments
|
||||
* @param (boolean) imports: Read import paths from the filesystem, and inject them into the script
|
||||
* @param (string) mode: Compression mode
|
||||
* @param (string) cwd: Current working directory
|
||||
* @param (string) content: CSS Sheets read
|
||||
* @param (regex) rcss: Matches css file name extension
|
||||
* @param (regex) rprefix: Matches absolute paths
|
||||
* @param (regex) rmarker: Marking points in css files when parsing for imports
|
||||
* @param (regex) rquote: Unescaped quote
|
||||
* @param (regex) rsinglequote: Unescaped single quote
|
||||
* @param (regex) rsemicolon: Unescaped semicolon
|
||||
* @param (regex) rimporturl: Import statement in a url() wrapper
|
||||
* @param (regex) rimportstr: Import statement in a string wrapper
|
||||
* @param (regex) rabsolutepath: Absolute path checker for import urls
|
||||
* @param (regex) rfsabsolutepath: Matches absolute paths for the file system
|
||||
*/
|
||||
private $instance;
|
||||
private $args = array();
|
||||
private $options = array();
|
||||
private $files = array();
|
||||
private $imports = true;
|
||||
private $mode = 'safe';
|
||||
private $cwd = '';
|
||||
private $content = '';
|
||||
private $rcss = "/\.css$/";
|
||||
private $rchopfile= "/\/[^\/]*$/";
|
||||
private $rmarker = "/(\/\*|\"|'|@import)/";
|
||||
private $rquote = "/(?<!\\\)\"/";
|
||||
private $rsinglequote = "/(?<!\\\)'/";
|
||||
private $rsemicolon = "/(?<!\\\);/";
|
||||
private $rimporturl = "/^@import url\(['\"]?(.*?)['\"]?\)/";
|
||||
private $rimportstr = "/^@import ['\"](.*?)['\"]/";
|
||||
private $rabsolutepath = "/^(https?:\/\/|\/)/";
|
||||
private $rfsabsolutepath = "/^(\/|\~\/|\\\|[a-z]:(\\\|\/)?)/i";
|
||||
|
||||
/**
|
||||
* Run the compression across files passed to cli
|
||||
*
|
||||
* @param (array) args: Array of argument passed over the command line
|
||||
*/
|
||||
public function __construct( $args = array() ) {
|
||||
// Render arguments
|
||||
$this->cwd = getcwd() . DIRECTORY_SEPARATOR;
|
||||
$this->args = $args;
|
||||
$this->read();
|
||||
|
||||
// Run the files through the css compressor
|
||||
$this->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the cli arguments and puts them in their place
|
||||
*
|
||||
* @params none
|
||||
*/
|
||||
private function read(){
|
||||
while ( count( $this->args ) ) {
|
||||
$arg = array_shift( $this->args );
|
||||
|
||||
// Adding contents of css files
|
||||
if ( preg_match( $this->rcss, $arg ) ) {
|
||||
// Handle absolute path prefixing
|
||||
if ( ! preg_match( $this->rfsabsolutepath, $arg ) && strpos( $arg, $this->cwd ) === false) {
|
||||
$path = $this->cwd . $arg;
|
||||
}
|
||||
else {
|
||||
$path = $arg;
|
||||
}
|
||||
|
||||
$this->content .= $this->imports( $path );
|
||||
}
|
||||
// Longhand options
|
||||
else if ( substr( $arg, 0, 2 ) == '--' ) {
|
||||
$parts = explode( '=', $arg, 2 );
|
||||
$name = substr( $parts[ 0 ], 2 );
|
||||
$value = isset( $parts[ 1 ] ) ? $parts[ 1 ] : true;
|
||||
|
||||
if ( $name == 'mode' ) {
|
||||
$this->mode = $value;
|
||||
}
|
||||
else if ( $name == 'imports' ) {
|
||||
$this->imports = true;
|
||||
}
|
||||
else {
|
||||
// Argument value is passed as string,
|
||||
// convert to boolean as needed
|
||||
if ( $value == 'false' ) {
|
||||
$value = false;
|
||||
}
|
||||
else if ( $value == 'true' ) {
|
||||
$value = true;
|
||||
}
|
||||
else {
|
||||
$value = intval( $value );
|
||||
}
|
||||
|
||||
$this->options[ $name ] = $value;
|
||||
}
|
||||
}
|
||||
// Shorthand options
|
||||
else if ( substr( $arg, 0, 1 ) == '-' && strlen( $arg ) == 2 ) {
|
||||
$char = substr( $arg, 1, 1 );
|
||||
|
||||
if ( $char == 'i' ) {
|
||||
$this->imports = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the css file for import defns
|
||||
*
|
||||
* @param (path) file: Path to the stylesheet passed as an argument
|
||||
*/
|
||||
private function imports( $file ) {
|
||||
// Set the content and the directory of the stylesheet
|
||||
$content = file_get_contents( $file );
|
||||
$cwd = preg_replace( $this->rchopfile, '/', $file );
|
||||
|
||||
// Block import fixing if not set
|
||||
if ( $this->imports === false ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rmarker, $content, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$marker = $match[ 1 ][ 0 ];
|
||||
if ( $marker == '/*' ) {
|
||||
if ( ( $pos = strpos( $content, '*/', $match[ 1 ][ 1 ] ) ) === false ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( $marker == '"' ) {
|
||||
if ( preg_match( $this->rquote, $content, $m, PREG_OFFSET_CAPTURE, $match[ 1 ][ 1 ] + 1 ) ) {
|
||||
$pos = $m[ 0 ][ 1 ] + 2;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( $marker == "'" ) {
|
||||
if ( preg_match( $this->rsinglequote, $content, $m, PREG_OFFSET_CAPTURE, $match[ 1 ][ 1 ] + 1 ) ) {
|
||||
$pos = $m[ 0 ][ 1 ] + 2;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( $marker == '@import' ) {
|
||||
list ( $content, $pos ) = $this->inject( $content, $cwd, $match[ 1 ][ 1 ] );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( 'Unknown Import Error' );
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the import declaration with it's contents
|
||||
*
|
||||
* @param (string) content: Contents of the stylesheet
|
||||
* @param (path) cwd: Directory of the current stylesheet
|
||||
* @param (int) pos: Position of the import declaration
|
||||
*/
|
||||
private function inject( $content, $cwd, $pos ) {
|
||||
if ( ! preg_match( $this->rsemicolon, $content, $m, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
throw new CSSCompression_Exception( "@import stmt at character position $pos, has no line-ending semicolon." );
|
||||
}
|
||||
$import = substr( $content, $pos, $m[ 0 ][ 1 ] + 1 - $pos );
|
||||
|
||||
// Check for valid import stmt, and replace into it the imports contents
|
||||
if ( ( preg_match( $this->rimporturl, $import, $m ) || preg_match( $this->rimportstr, $import, $m ) ) &&
|
||||
! preg_match( $this->rabsolutepath, $m[ 1 ] ) ) {
|
||||
if ( ! file_exists( $cwd . $m[ 1 ] ) ) {
|
||||
throw new CSSCompression_Exception( "Import Path '" . $cwd . $m[ 1 ] . "' not found." );
|
||||
}
|
||||
$content = substr_replace( $content, file_get_contents( $cwd . $m[ 1 ] ), $pos, strlen( $import ) );
|
||||
}
|
||||
else {
|
||||
$pos += strlen( $import );
|
||||
}
|
||||
|
||||
return array( $content, $pos );
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the compression of the content read
|
||||
*
|
||||
* @params none
|
||||
*/
|
||||
private function render(){
|
||||
$this->instance = new CSSCompression();
|
||||
|
||||
if ( $this->mode ) {
|
||||
$this->instance->mode( $this->mode );
|
||||
}
|
||||
|
||||
if ( $this->options ) {
|
||||
$this->instance->option( $this->options );
|
||||
}
|
||||
|
||||
echo $this->instance->compress( $this->content );
|
||||
}
|
||||
};
|
||||
|
||||
// Auto-initialize the cli script
|
||||
new CSSCompression_Cli( $_SERVER['argv'] );
|
||||
|
||||
?>
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
{
|
||||
"#f0ffff":"azure",
|
||||
"#f5f5dc":"beige",
|
||||
"#ffe4c4":"bisque",
|
||||
"#a52a2a":"brown",
|
||||
"#ff7f50":"coral",
|
||||
"#ffd700":"gold",
|
||||
"#808080":"gray",
|
||||
"#008000":"green",
|
||||
"#4b0082":"indigo",
|
||||
"#fffff0":"ivory",
|
||||
"#f0e68c":"khaki",
|
||||
"#faf0e6":"linen",
|
||||
"#800000":"maroon",
|
||||
"#000080":"navy",
|
||||
"#808000":"olive",
|
||||
"#ffa500":"orange",
|
||||
"#da70d6":"orchid",
|
||||
"#cd853f":"peru",
|
||||
"#ffc0cb":"pink",
|
||||
"#dda0dd":"plum",
|
||||
"#800080":"purple",
|
||||
"#ff0000":"red",
|
||||
"#fa8072":"salmon",
|
||||
"#a0522d":"sienna",
|
||||
"#c0c0c0":"silver",
|
||||
"#fffafa":"snow",
|
||||
"#d2b48c":"tan",
|
||||
"#008080":"teal",
|
||||
"#ff6347":"tomato",
|
||||
"#ee82ee":"violet",
|
||||
"#f5deb3":"wheat",
|
||||
"#f00":"red"
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
{
|
||||
"#808080":"gray",
|
||||
"#008000":"green",
|
||||
"#800000":"maroon",
|
||||
"#000080":"navy",
|
||||
"#808000":"olive",
|
||||
"#ff0000":"red",
|
||||
"#c0c0c0":"silver",
|
||||
"#008080":"teal",
|
||||
"#f00":"red"
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
{
|
||||
"aliceblue":"#f0f8ff",
|
||||
"antiquewhite":"#faebd7",
|
||||
"aquamarine":"#7fffd4",
|
||||
"bisque":"#ffe4c4",
|
||||
"black":"#000000",
|
||||
"blanchedalmond":"#ffebcd",
|
||||
"blueviolet":"#8a2be2",
|
||||
"burlywood":"#deb887",
|
||||
"cadetblue":"#5f9ea0",
|
||||
"chartreuse":"#7fff00",
|
||||
"chocolate":"#d2691e",
|
||||
"coral":"#ff7f50",
|
||||
"cornflowerblue":"#6495ed",
|
||||
"cornsilk":"#fff8dc",
|
||||
"crimson":"#dc143c",
|
||||
"cyan":"#00ffff",
|
||||
"darkblue":"#00008b",
|
||||
"darkcyan":"#008b8b",
|
||||
"darkgoldenrod":"#b8860b",
|
||||
"darkgray":"#a9a9a9",
|
||||
"darkgreen":"#006400",
|
||||
"darkkhaki":"#bdb76b",
|
||||
"darkmagenta":"#8b008b",
|
||||
"darkolivegreen":"#556b2f",
|
||||
"darkorange":"#ff8c00",
|
||||
"darkorchid":"#9932cc",
|
||||
"darkred":"#8b0000",
|
||||
"darksalmon":"#e9967a",
|
||||
"darkseagreen":"#8fbc8f",
|
||||
"darkslateblue":"#483d8b",
|
||||
"darkslategray":"#2f4f4f",
|
||||
"darkturquoise":"#00ced1",
|
||||
"darkviolet":"#9400d3",
|
||||
"deeppink":"#ff1493",
|
||||
"deepskyblue":"#00bfff",
|
||||
"dimgray":"#696969",
|
||||
"dodgerblue":"#1e90ff",
|
||||
"firebrick":"#b22222",
|
||||
"floralwhite":"#fffaf0",
|
||||
"forestgreen":"#228b22",
|
||||
"fuchsia":"#ff00ff",
|
||||
"gainsboro":"#dcdcdc",
|
||||
"ghostwhite":"#f8f8ff",
|
||||
"goldenrod":"#daa520",
|
||||
"green":"#008800",
|
||||
"greenyellow":"#adff2f",
|
||||
"honeydew":"#f0fff0",
|
||||
"hotpink":"#ff69b4",
|
||||
"indianred ":"#cd5c5c",
|
||||
"indigo ":"#4b0082",
|
||||
"lavender":"#e6e6fa",
|
||||
"lavenderblush":"#fff0f5",
|
||||
"lawngreen":"#7cfc00",
|
||||
"lemonchiffon":"#fffacd",
|
||||
"lightblue":"#add8e6",
|
||||
"lightcoral":"#f08080",
|
||||
"lightcyan":"#e0ffff",
|
||||
"lightgoldenrodyellow":"#fafad2",
|
||||
"lightgrey":"#d3d3d3",
|
||||
"lightgreen":"#90ee90",
|
||||
"lightpink":"#ffb6c1",
|
||||
"lightsalmon":"#ffa07a",
|
||||
"lightseagreen":"#20b2aa",
|
||||
"lightskyblue":"#87cefa",
|
||||
"lightslategray":"#778899",
|
||||
"lightsteelblue":"#b0c4de",
|
||||
"lightyellow":"#ffffe0",
|
||||
"lime":"#00ff00",
|
||||
"limegreen":"#32cd32",
|
||||
"magenta":"#ff00ff",
|
||||
"maroon":"#800000",
|
||||
"mediumaquamarine":"#66cdaa",
|
||||
"mediumblue":"#0000cd",
|
||||
"mediumorchid":"#ba55d3",
|
||||
"mediumpurple":"#9370d8",
|
||||
"mediumseagreen":"#3cb371",
|
||||
"mediumslateblue":"#7b68ee",
|
||||
"mediumspringgreen":"#00fa9a",
|
||||
"mediumturquoise":"#48d1cc",
|
||||
"mediumvioletred":"#c71585",
|
||||
"midnightblue":"#191970",
|
||||
"mintcream":"#f5fffa",
|
||||
"mistyrose":"#ffe4e1",
|
||||
"moccasin":"#ffe4b5",
|
||||
"navajowhite":"#ffdead",
|
||||
"oldlace":"#fdf5e6",
|
||||
"olivedrab":"#6b8e23",
|
||||
"orange":"#ffa500",
|
||||
"orangered":"#ff4500",
|
||||
"orchid":"#da70d6",
|
||||
"palegoldenrod":"#eee8aa",
|
||||
"palegreen":"#98fb98",
|
||||
"paleturquoise":"#afeeee",
|
||||
"palevioletred":"#d87093",
|
||||
"papayawhip":"#ffefd5",
|
||||
"peachpuff":"#ffdab9",
|
||||
"powderblue":"#b0e0e6",
|
||||
"purple":"#800080",
|
||||
"rosybrown":"#bc8f8f",
|
||||
"royalblue":"#4169e1",
|
||||
"saddlebrown":"#8b4513",
|
||||
"salmon":"#fa8072",
|
||||
"sandybrown":"#f4a460",
|
||||
"seagreen":"#2e8b57",
|
||||
"seashell":"#fff5ee",
|
||||
"sienna":"#a0522d",
|
||||
"silver":"#c0c0c0",
|
||||
"skyblue":"#87ceeb",
|
||||
"slateblue":"#6a5acd",
|
||||
"slategray":"#708090",
|
||||
"springgreen":"#00ff7f",
|
||||
"steelblue":"#4682b4",
|
||||
"thistle":"#d8bfd8",
|
||||
"tomato":"#ff6347",
|
||||
"turquoise":"#40e0d0",
|
||||
"violet":"#ee82ee",
|
||||
"white":"#ffffff",
|
||||
"whitesmoke":"#f5f5f5",
|
||||
"yellow":"#ffff00",
|
||||
"yellowgreen":"#9acd32"
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Cleanup
|
||||
{
|
||||
|
||||
/**
|
||||
* Cleanup patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (string) token: Copy of the injection token
|
||||
* @param (regex) rtoken: Token regex built upon instantiation
|
||||
* @param (array) options: Reference to options
|
||||
* @param (regex) rsemi: Checks for last semit colon in details
|
||||
* @param (regex) rsemicolon: Checks for semicolon without an escape '\' character before it
|
||||
* @param (regex) rspace: Checks for space without an escape '\' character before it
|
||||
* @param (regex) rcolon: Checks for colon without an escape '\' character before it
|
||||
* @param (regex) rquote: Checks for quote (') without an escape '\' character before it
|
||||
* @param (array) rescape: Array of patterns for groupings that should be escaped
|
||||
* @param (array) escaped: Contains patterns and replacements for espaced characters
|
||||
*/
|
||||
private $Control;
|
||||
private $token = '';
|
||||
private $rtoken = '';
|
||||
private $options = array();
|
||||
private $rsemi = "/;$/";
|
||||
private $rsemicolon = "/(?<!\\\);/";
|
||||
private $rspace = "/(?<!\\\)\s/";
|
||||
private $rcolon = "/(?<!\\\):/";
|
||||
private $rquote = "/(?<!\\\)'/";
|
||||
private $rescape = array(
|
||||
"/((?<!\\\)\")(.*?)((?<!\\\)\")/",
|
||||
"/((?<!\\\)')(.*?)((?<!\\\)')/",
|
||||
"/(url\()(.*?)(\))/",
|
||||
);
|
||||
private $escaped = array(
|
||||
'search' => array(
|
||||
"\\:",
|
||||
"\\;",
|
||||
"\\}",
|
||||
"\\{",
|
||||
"\\@",
|
||||
"\\!",
|
||||
"\\,",
|
||||
"\\>",
|
||||
"\\+",
|
||||
"\\~",
|
||||
"\\/",
|
||||
"\\*",
|
||||
"\\.",
|
||||
"\\=",
|
||||
"\\#",
|
||||
"\\r",
|
||||
"\\n",
|
||||
"\\t",
|
||||
"\\ ",
|
||||
),
|
||||
'replace' => array(
|
||||
":",
|
||||
";",
|
||||
"}",
|
||||
"{",
|
||||
"@",
|
||||
"!",
|
||||
",",
|
||||
">",
|
||||
"+",
|
||||
"~",
|
||||
"/",
|
||||
"*",
|
||||
".",
|
||||
"=",
|
||||
"#",
|
||||
"\r",
|
||||
"\n",
|
||||
"\t",
|
||||
" ",
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Build the token regex based on defined token
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->token = CSSCompression::TOKEN;
|
||||
$this->options = &$control->Option->options;
|
||||
|
||||
// Have to build the token regexs after initialization
|
||||
$this->rtoken = "/($this->token)(.*?)($this->token)/";
|
||||
array_push( $this->rescape, $this->rtoken );
|
||||
}
|
||||
|
||||
/**
|
||||
* Central cleanup process, removes all injections
|
||||
*
|
||||
* @param (array) selectors: Array of selectors
|
||||
* @param (array) details: Array of details
|
||||
*/
|
||||
public function cleanup( &$selectors, &$details ) {
|
||||
foreach ( $details as $i => &$value ) {
|
||||
// Auto skip sections
|
||||
if ( isset( $selectors[ $i ] ) && strpos( $selectors[ $i ], $this->token ) === 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Removing dupes
|
||||
if ( $this->options['rm-multi-define'] ) {
|
||||
$value = $this->removeMultipleDefinitions( $value );
|
||||
}
|
||||
|
||||
$value = $this->removeUnnecessarySemicolon( $value );
|
||||
}
|
||||
|
||||
return array( $selectors, $details );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes '\' from possible splitter characters in URLs
|
||||
*
|
||||
* @param (string) css: Full css sheet
|
||||
*/
|
||||
public function removeInjections( $css ) {
|
||||
// Remove escaped characters
|
||||
foreach ( $this->rescape as $regex ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $regex, $css, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$value = $match[ 1 ][ 0 ]
|
||||
. str_replace( $this->escaped['search'], $this->escaped['replace'], $match[ 2 ][ 0 ] )
|
||||
. $match[ 3 ][ 0 ];
|
||||
$css = substr_replace( $css, $value, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $value ) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove token injections
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rtoken, $css, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$value = $match[ 2 ][ 0 ];
|
||||
if ( preg_match( $this->rspace, $value ) ) {
|
||||
$quote = preg_match( $this->rquote, $value ) ? "\"" : "'";
|
||||
$value = "$quote$value$quote";
|
||||
$css = substr_replace( $css, $value, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $value ) + 1;
|
||||
}
|
||||
else {
|
||||
$css = substr_replace( $css, $value, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $value ) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes multiple definitions that were created during compression
|
||||
*
|
||||
* @param (string) val: CSS Selector Properties
|
||||
*/
|
||||
private function removeMultipleDefinitions( $val = '' ) {
|
||||
$storage = array();
|
||||
$arr = preg_split( $this->rsemicolon, $val );
|
||||
|
||||
foreach ( $arr as $x ) {
|
||||
if ( $x ) {
|
||||
list( $a, $b ) = preg_split( $this->rcolon, $x, 2 );
|
||||
$storage[ $a ] = $b;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $storage ) {
|
||||
$val = '';
|
||||
foreach ( $storage as $x => $y ) {
|
||||
$val .= "$x:$y;";
|
||||
}
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes last semicolons on the final property of a set
|
||||
*
|
||||
* @param (string) value: rule set
|
||||
*/
|
||||
private function removeUnnecessarySemicolon( $value ) {
|
||||
return preg_replace( $this->rsemi, '', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
if ( $method == 'cleanup' ) {
|
||||
return $this->cleanup( $args[ 0 ], $args[ 1 ] );
|
||||
}
|
||||
else {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Cleanup Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,199 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Color
|
||||
{
|
||||
/**
|
||||
* Color Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (array) options: Reference to options array
|
||||
* @param (regex) rrgb: Checks for rgb notation
|
||||
* @param (regex) rhex: Checks for hex code
|
||||
* @param (regex) rfullhex: Checks for full 6 character hex code
|
||||
* @static (array) color2hex: Long color name to hex code conversions
|
||||
* @static (array) hex2short: Hex code to short color name conversions
|
||||
* @static (array) hex2short_safe: CSS Level 1 safe color names that are shorter than hex codes
|
||||
* @static (array) files: List of static helpers with their class vars
|
||||
*/
|
||||
private $Control;
|
||||
private $options = array();
|
||||
private $rrgb = "/^rgb\((\d{1,3}\%?(,\d{1,3}\%?,\d{1,3}\%?)?)\)$/i";
|
||||
private $rhex = "/^#([0-9a-f]{3}|[0-9a-f]{6})$/i";
|
||||
private $rfullhex = "/^#([0-9a-f]{6})$/i";
|
||||
private static $color2hex = array();
|
||||
private static $hex2short = array();
|
||||
private static $hex2short_safe = array();
|
||||
private static $files = array(
|
||||
'color2hex' => 'long2hex-colors.json',
|
||||
'hex2short' => 'hex2short-colors.json',
|
||||
'hex2short_safe' => 'hex2short-safe.json',
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
* and install conversion helpers
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->options = &$control->Option->options;
|
||||
|
||||
if ( ! self::$color2hex ) {
|
||||
foreach ( self::$files as $v => $file ) {
|
||||
self::$$v = CSSCompression::getJSON( $file );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Central handler for all color conversions.
|
||||
*
|
||||
* @param (string) val: Color to be parsed
|
||||
*/
|
||||
public function color( $val ) {
|
||||
// Converts rgb values to hex codes
|
||||
if ( $this->options['color-rgb2hex'] ) {
|
||||
$val = $this->rgb2hex( $val );
|
||||
}
|
||||
|
||||
// Convert long color names to hex codes
|
||||
if ( $this->options['color-long2hex'] ) {
|
||||
$val = $this->color2hex( $val );
|
||||
}
|
||||
|
||||
// Ensure all hex codes are lowercase
|
||||
if ( preg_match( $this->rhex, $val ) ) {
|
||||
$val = strtolower( $val );
|
||||
}
|
||||
|
||||
// Convert large hex codes to small codes
|
||||
if ( $this->options['color-hex2shorthex'] ) {
|
||||
$val = $this->hex2short( $val );
|
||||
}
|
||||
|
||||
// Convert 6 digit hex codes to short color names
|
||||
if ( $this->options['color-hex2shortcolor'] ) {
|
||||
$val = $this->hex2color( $val );
|
||||
}
|
||||
|
||||
// Convert safe css level1 color names
|
||||
if ( $this->options['color-hex2safe'] ) {
|
||||
$val = $this->hex2safe( $val );
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts rgb values to hex codes
|
||||
*
|
||||
* @param (string) val: Color to be converted
|
||||
*/
|
||||
private function rgb2hex( $val ) {
|
||||
if ( ! preg_match( $this->rrgb, $val, $match ) ) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
// locals
|
||||
$hex = '0123456789abcdef';
|
||||
$str = explode( ',', $match[ 1 ] );
|
||||
$new = '';
|
||||
|
||||
// Incase rgb was defined with single val
|
||||
if ( ! $str ) {
|
||||
$str = array( $match[ 1 ] );
|
||||
}
|
||||
|
||||
foreach ( $str as $x ) {
|
||||
$x = strpos( $x, '%' ) !== false ? intval( ( intval( $x ) / 100 ) * 255 ) : intval( $x );
|
||||
|
||||
if ( $x > 255 ) {
|
||||
$x = 255;
|
||||
}
|
||||
|
||||
if ( $x < 0 ) {
|
||||
$x = 0;
|
||||
}
|
||||
|
||||
$new .= $hex[ ( $x - $x % 16 ) / 16 ];
|
||||
$new .= $hex[ $x % 16 ];
|
||||
}
|
||||
|
||||
// Repeat hex code to complete 6 digit hex requirement for single definitions
|
||||
if ( count( $str ) == 1 ) {
|
||||
$new .= $new . $new;
|
||||
}
|
||||
|
||||
// Replace with hex value
|
||||
return "#$new";
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert long color names to hex codes
|
||||
*
|
||||
* @param (string) val: Color to be converted
|
||||
*/
|
||||
private function color2hex( $val ) {
|
||||
return isset( self::$color2hex[ $val ] ) ? self::$color2hex[ $val ] : $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert large hex codes to small codes
|
||||
*
|
||||
* @param (string) val: Hex to be shortened
|
||||
*/
|
||||
private function hex2short( $val ) {
|
||||
if ( ! preg_match( $this->rfullhex, $val, $match ) ) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
// See if we can convert to 3 char hex
|
||||
$hex = $match[ 1 ];
|
||||
if ( $hex[ 0 ] == $hex[ 1 ] && $hex[ 2 ] == $hex[ 3 ] && $hex[ 4 ] == $hex[ 5 ] ) {
|
||||
$val = '#' . $hex[ 0 ] . $hex[ 2 ] . $hex[ 4 ];
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert large hex codes to small codes
|
||||
*
|
||||
* @param (string) val: Color to be converted
|
||||
*/
|
||||
private function hex2color( $val ) {
|
||||
return isset( self::$hex2short[ $val ] ) ? self::$hex2short[ $val ] : $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert large hex codes to small codes
|
||||
*
|
||||
* @param (string) val: Color to be converted
|
||||
*/
|
||||
private function hex2safe( $val ) {
|
||||
return isset( self::$hex2short_safe[ $val ] ) ? self::$hex2short_safe[ $val ] : $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Color Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,191 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (string) token: Copy of the injection token
|
||||
* @param (array) options: Reference to options
|
||||
* @param (regex) rspace: Checks for space without an escape '\' character before it
|
||||
* @param (regex) rslash: Checks for unescaped slash character
|
||||
* @param (regex) rimportant: Checking props for uncombinables
|
||||
* @param (array) methods: List of options with their corresponding class
|
||||
*/
|
||||
private $Control;
|
||||
private $token = '';
|
||||
private $options = array();
|
||||
private $rspace = "/(?<!\\\)\s/";
|
||||
private $rslash = "/(?<!\\\)\//";
|
||||
private $rimportant = "/inherit|\!important|\!ie|(?<!\\\)\s/i";
|
||||
private $methods = array(
|
||||
'csw-combine' => 'BorderOutline',
|
||||
'border-radius-combine' => 'BorderRadius',
|
||||
'border-combine' => 'Border',
|
||||
'mp-combine' => 'MarginPadding',
|
||||
'background-combine' => 'Background',
|
||||
'auralcp-combine' => 'Aural',
|
||||
'font-combine' => 'Font',
|
||||
'list-combine' => 'List',
|
||||
);
|
||||
|
||||
/**
|
||||
* Sub Comination Classes
|
||||
*
|
||||
* @class BorderOutline: Handles Color/Style/With combinations of border/outline properties
|
||||
* @class BorderRadius: Handles border-radius combinations
|
||||
* @class Border: Handles normal border combinations
|
||||
* @class MarginPadding: Handles margin/padding combinations
|
||||
* @class Background: Handles background combinations
|
||||
* @class Aural: Handles aural combinations
|
||||
* @class Font: Handles font combinations
|
||||
* @class List: Handles list combinations
|
||||
* @param (array) subcombines: Array holding all subcombination classes
|
||||
*/
|
||||
public $BorderOutline;
|
||||
public $BorderRadius;
|
||||
public $Border;
|
||||
public $MarginPadding;
|
||||
public $Background;
|
||||
public $Aural;
|
||||
public $Font;
|
||||
public $List;
|
||||
private $subcombines = array(
|
||||
'BorderOutline',
|
||||
'BorderRadius',
|
||||
'Border',
|
||||
'MarginPadding',
|
||||
'Background',
|
||||
'Aural',
|
||||
'Font',
|
||||
'List',
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->token = CSSCompression::TOKEN;
|
||||
$this->options = &$control->Option->options;
|
||||
|
||||
// Include classes if not already done so
|
||||
if ( ! class_exists( "CSSCompression_Combine_Border", false ) ) {
|
||||
$path = dirname(__FILE__) . '/Combine/';
|
||||
foreach ( $this->subcombines as $class ) {
|
||||
require( $path . $class . '.php' );
|
||||
}
|
||||
}
|
||||
|
||||
// Instantiate each sub combine
|
||||
foreach ( $this->subcombines as $class ) {
|
||||
$full = "CSSCompression_Combine_$class";
|
||||
$this->$class = new $full( $control, $this );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads through each detailed package and checks for cross defn combinations
|
||||
*
|
||||
* @param (array) selectors: Array of selectors
|
||||
* @param (array) details: Array of details
|
||||
*/
|
||||
public function combine( &$selectors = array(), &$details = array() ) {
|
||||
foreach ( $details as $i => &$value ) {
|
||||
if ( isset( $selectors[ $i ] ) && strpos( $selectors[ $i ], $this->token ) === 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ( $this->methods as $option => $class ) {
|
||||
if ( $this->options[ $option ] ) {
|
||||
$value = $this->$class->combine( $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array( $selectors, $details );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to ensure flagged words don't get
|
||||
* overridden
|
||||
*
|
||||
* @param (mixed) obj: Array/String of definitions to be checked
|
||||
*/
|
||||
public function checkUncombinables( $obj ) {
|
||||
if ( is_array( $obj ) ) {
|
||||
foreach ( $obj as $item ) {
|
||||
if ( preg_match( $this->rimportant, $item ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return preg_match( $this->rimportant, $obj );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to ensure all values of search array
|
||||
* exist within the storage array
|
||||
*
|
||||
* @param (string) prop: CSS Property
|
||||
* @param (array) storage: Array of definitions found
|
||||
* @param (array) search: Array of definitions requred
|
||||
*/
|
||||
public function searchDefinitions( $prop, $storage, $search ) {
|
||||
// Return if storage & search don't match
|
||||
if ( count( $storage ) != count( $search ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$str = "$prop:";
|
||||
foreach ( $search as $value ) {
|
||||
if ( ! isset( $storage[ $value ] ) || $this->checkUncombinables( $storage[ $value ] ) ) {
|
||||
return false;
|
||||
}
|
||||
$str .= $storage[ $value ] . ' ';
|
||||
}
|
||||
return trim( $str ) . ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) subclass: Name of subclass to focus on
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $subclass, $method, $args ) {
|
||||
if ( $subclass == 'Combine' ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
if ( $method == 'combine' ) {
|
||||
return $this->combine( $args[ 0 ], $args[ 1 ] );
|
||||
}
|
||||
else {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Combine Class - " . $method );
|
||||
}
|
||||
}
|
||||
else if ( in_array( $subclass, $this->subcombines ) ) {
|
||||
return $this->$subclass->access( $method, $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown Sub Combine Class - " . $subclass );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,109 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine_Aural
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Combine: Combine Controller
|
||||
* @param (regex) raural: Aurual matching
|
||||
*/
|
||||
private $Control;
|
||||
private $Combine;
|
||||
private $raural = "/(^|(?<!\\\);)(cue|pause)-(before|after):(.*?)((?<!\\\);|$)/";
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller & combiner
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
* @param (class) combine: CSSCompression Combiner
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
||||
$this->Control = $control;
|
||||
$this->Combine = $combine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines Aural properties (currently being depreciated in W3C Standards)
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
public function combine( $val ) {
|
||||
$storage = $this->storage( $val );
|
||||
$pos = 0;
|
||||
|
||||
// Replace first occurance with it's prop, and remove all following occurances
|
||||
while ( preg_match( $this->raural, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$prop = $match[ 2 ][ 0 ];
|
||||
if ( isset( $storage[ $prop ] ) ) {
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $storage[ $prop ], $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $storage[ $prop ] ) - $colon - 1;
|
||||
$storage[ $prop ] = '';
|
||||
}
|
||||
else {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a storage object for iteration
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
private function storage( $val ) {
|
||||
$storage = array();
|
||||
|
||||
// Find all possible occurences and build the replacement
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->raural, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
if ( ! isset( $storage[ $match[ 2 ][ 0 ] ] ) ) {
|
||||
$storage[ $match[ 2 ][ 0 ] ] = array( $match[ 3 ][ 0 ] => $match[ 4 ][ 0 ] );
|
||||
}
|
||||
|
||||
// Override double written properties
|
||||
$storage[ $match[ 2 ][ 0 ] ][ $match[ 3 ][ 0 ] ] = $match[ 4 ][ 0 ];
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
|
||||
// Go through each tag for possible combination
|
||||
foreach ( $storage as $tag => $arr ) {
|
||||
// All three have to be defined
|
||||
if ( count( $arr ) == 2 && ! $this->Combine->checkUncombinables( $arr ) ) {
|
||||
$storage[ $tag ] = "$tag:" . $arr['before'] . ' ' . $arr['after'] . ';';
|
||||
}
|
||||
else {
|
||||
unset( $storage[ $tag ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Aural Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine_Background
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Combine: Combine Controller
|
||||
* @param (regex) rbackground: Background matching
|
||||
* @param (array) groupings: List of background combinations
|
||||
*/
|
||||
private $Control;
|
||||
private $Combine;
|
||||
private $rbackground = "/(^|(?<!\\\);)background-(color|image|repeat|attachment|position):(.*?)((?<!\\\);|$)/";
|
||||
private $groupings = array(
|
||||
// With color
|
||||
array( 'color', 'image', 'repeat', 'attachment', 'position' ),
|
||||
array( 'color', 'image', 'attachment', 'position' ),
|
||||
array( 'color', 'image', 'repeat', 'position' ),
|
||||
array( 'color', 'image', 'repeat', 'attachment' ),
|
||||
array( 'color', 'image', 'repeat' ),
|
||||
array( 'color', 'image', 'attachment' ),
|
||||
array( 'color', 'image', 'position' ),
|
||||
array( 'color', 'image' ),
|
||||
// Without Color
|
||||
array( 'image', 'attachment', 'position' ),
|
||||
array( 'image', 'repeat', 'position' ),
|
||||
array( 'image', 'repeat', 'attachment' ),
|
||||
array( 'image', 'repeat' ),
|
||||
array( 'image', 'attachment' ),
|
||||
array( 'image', 'position' ),
|
||||
// Just Color/Image
|
||||
array( 'image' ),
|
||||
array( 'color' ),
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller & combiner
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
* @param (class) combine: CSSCompression Combiner
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
||||
$this->Control = $control;
|
||||
$this->Combine = $combine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines multiple background props into single definition
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
public function combine( $val ) {
|
||||
$storage = array();
|
||||
|
||||
// Find all possible occurences and build the replacement
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rbackground, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$storage[ $match[ 2 ][ 0 ] ] = $match[ 3 ][ 0 ];
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
|
||||
// Run background checks and get replacement str
|
||||
foreach ( $this->groupings as $props ) {
|
||||
if ( $replace = $this->Combine->searchDefinitions( 'background', $storage, $props ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If replacement string found, run it on all declarations
|
||||
if ( $replace ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rbackground, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
|
||||
$replace = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Background Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine_Border
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Combine: Combine Controller
|
||||
* @param (regex) rborder: Border matching
|
||||
*/
|
||||
private $Control;
|
||||
private $Combine;
|
||||
private $rborder = "/(^|(?<!\\\);)border-(top|right|bottom|left):(.*?)((?<!\\\);|$)/";
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller & combiner
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
* @param (class) combine: CSSCompression Combiner
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
||||
$this->Control = $control;
|
||||
$this->Combine = $combine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines multiple border properties into single definition
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
public function combine( $val ) {
|
||||
if ( ( $replace = $this->replace( $val ) ) === false ) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
// Rebuild the rule set with the combinations found
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rborder, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
|
||||
$replace = '';
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a replacement string
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
private function replace( $val ) {
|
||||
$storage = array();
|
||||
|
||||
// Find all possible occurences and build the replacement
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rborder, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
// Override double written properties
|
||||
$storage[ $match[ 2 ][ 0 ] ] = $match[ 3 ][ 0 ];
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
|
||||
// All 4 have to be defined
|
||||
if ( count( $storage ) == 4 &&
|
||||
$storage['top'] == $storage['bottom'] &&
|
||||
$storage['left'] == $storage['right'] &&
|
||||
$storage['top'] == $storage['right'] ) {
|
||||
return "border:" . $storage['top'] . ';';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Border Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,109 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine_BorderOutline
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Combine: Combine Controller
|
||||
* @param (regex) rcsw: Border/Outline matching
|
||||
*/
|
||||
private $Control;
|
||||
private $Combine;
|
||||
private $rcsw = "/(^|(?<!\\\);)(border|border-top|border-bottom|border-left|border-right|outline)-(color|style|width):(.*?)((?<!\\\);|$)/";
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller & combiner
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
* @param (class) combine: CSSCompression Combiner
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
||||
$this->Control = $control;
|
||||
$this->Combine = $combine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines color/style/width of border/outline properties
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
public function combine( $val ) {
|
||||
$storage = $this->storage( $val );
|
||||
$pos = 0;
|
||||
|
||||
// Now rebuild the string replacing all instances
|
||||
while ( preg_match( $this->rcsw, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$prop = $match[ 2 ][ 0 ];
|
||||
if ( isset( $storage[ $prop ] ) ) {
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $storage[ $prop ], $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $storage[ $prop ] ) - $colon - 1;
|
||||
$storage[ $prop ] = '';
|
||||
}
|
||||
else {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a storage object for iteration
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
private function storage( $val ) {
|
||||
$storage = array();
|
||||
$pos = 0;
|
||||
|
||||
// Find all possible occurences and build the replacement
|
||||
while ( preg_match( $this->rcsw, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
if ( ! isset( $storage[ $match[ 2 ][ 0 ] ] ) ) {
|
||||
$storage[ $match[ 2 ][ 0 ] ] = array( $match[ 3 ][ 0 ] => $match[ 4 ][ 0 ] );
|
||||
}
|
||||
|
||||
// Override double written properties
|
||||
$storage[ $match[ 2 ][ 0 ] ][ $match[ 3 ][ 0 ] ] = $match[ 4 ][ 0 ];
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
|
||||
// Go through each tag for possible combination
|
||||
foreach ( $storage as $tag => $arr ) {
|
||||
// All three have to be defined
|
||||
if ( count( $arr ) == 3 && ! $this->Combine->checkUncombinables( $arr ) ) {
|
||||
$storage[ $tag ] = "$tag:" . $arr['width'] . ' ' . $arr['style'] . ' ' . $arr['color'] . ';';
|
||||
}
|
||||
else {
|
||||
unset( $storage[ $tag ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in BorderOutline Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,263 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine_BorderRadius
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Combine: Combine Controller
|
||||
* @param (regex) rspace: Checks for space without an escape '\' character before it
|
||||
* @param (regex) rslash: Checks for unescaped slash character
|
||||
* @param (array) borderRadius: Various border radii components
|
||||
*/
|
||||
private $Control;
|
||||
private $Combine;
|
||||
private $rspace = "/(?<!\\\)\s/";
|
||||
private $rslash = "/(?<!\\\)\//";
|
||||
private $borderRadius = array(
|
||||
'css3' => array(
|
||||
'mod' => '',
|
||||
'base' => "/(^|(?<!\\\);)border-radius:(.*?)((?<!\\\);|$)/",
|
||||
'full' => "/(^|(?<!\\\);)border-(top|bottom)-(left|right)-radius:(.*?)((?<!\\\);|$)/",
|
||||
),
|
||||
'moz' => array(
|
||||
'mod' => '-moz-',
|
||||
'base' => "/(^|(?<!\\\);)-moz-border-radius:(.*?)((?<!\\\);|$)/",
|
||||
'full' => "/(^|(?<!\\\);)-moz-border-radius-(top|bottom)(left|right):(.*?)((?<!\\\);|$)/"
|
||||
),
|
||||
'webkit' => array(
|
||||
'mod' => '-webkit-',
|
||||
'base' => "/(^|(?<!\\\);)-webkit-border-radius:(.*?)((?<!\\\);|$)/",
|
||||
'full' => "/(^|(?<!\\\);)-webkit-border-(top|bottom)-(left|right)-radius:(.*?)((?<!\\\);|$)/"
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller & combiner
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
* @param (class) combine: CSSCompression Combiner
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
||||
$this->Control = $control;
|
||||
$this->Combine = $combine;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Main handler to combine border-radii into a single rule
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
public function combine( $val ) {
|
||||
foreach ( $this->borderRadius as $regex ) {
|
||||
$val = $this->fix( $val, $regex );
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the actual combining
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
private function fix( $val, $regex ) {
|
||||
$val = $this->base( $val, $regex );
|
||||
$replace = $regex['mod'];
|
||||
|
||||
// Storage builder
|
||||
if ( ( $storage = $this->storage( $val, $regex ) ) === false ) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
// Setup horizontal/vertical radii
|
||||
foreach ( $storage as $dir => &$config ) {
|
||||
// Verticals are optional
|
||||
if ( $dir == 'vertical' && ! $config['keep'] ) {
|
||||
break;
|
||||
}
|
||||
// All 4 are the same
|
||||
else if ( $config['top-left'] == $config['top-right'] &&
|
||||
$config['top-right'] == $config['bottom-right'] &&
|
||||
$config['bottom-right'] == $config['bottom-left'] ) {
|
||||
$config['replace'] .= $config['top-left'];
|
||||
}
|
||||
// Opposites are the same
|
||||
else if ( $config['top-left'] == $config['bottom-right'] && $config['top-right'] == $config['bottom-left'] ) {
|
||||
$config['replace'] .= $config['top-left'] . ' ' . $config['top-right'];
|
||||
}
|
||||
// 3-point directional
|
||||
else if ( $config['top-right'] == $config['bottom-left'] ) {
|
||||
$config['replace'] .= $config['top-left'] . ' ' . $config['top-right'] . ' ' . $config['bottom-right'];
|
||||
}
|
||||
// none are the same, but can still use shorthand notation
|
||||
else {
|
||||
$config['replace'] .= $config['top-left'] . ' ' . $config['top-right'] . ' '
|
||||
. $config['bottom-right'] . ' ' . $config['bottom-left'];
|
||||
}
|
||||
}
|
||||
|
||||
// Now rebuild the string replacing all instances of margin/padding if shorthand exists
|
||||
$pos = 0;
|
||||
$replace = $regex['mod'] . "border-radius:" . $storage['horizontal']['replace'] . $storage['vertical']['replace'] . ';';
|
||||
while ( preg_match( $regex['full'], $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
|
||||
$replace = '';
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expands short handed border radius props for combination
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
private function base( $val, $regex ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $regex['base'], $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$replace = '';
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$parts = preg_split( $this->rslash, trim( $match[ 2 ][ 0 ] ), 2 );
|
||||
$positions = array(
|
||||
'top-left' => 0,
|
||||
'top-right' => 0,
|
||||
'bottom-right' => 0,
|
||||
'bottom-left' => 0,
|
||||
);
|
||||
$base = array(
|
||||
'horizontal' => array(
|
||||
'parts' => preg_split( $this->rspace, trim( $parts[ 0 ] ) ),
|
||||
'pos' => $positions,
|
||||
),
|
||||
'vertical' => array(
|
||||
'parts' => isset( $parts[ 1 ] ) ? preg_split( $this->rspace, trim( $parts[ 1 ] ) ) : '',
|
||||
'pos' => $positions,
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( $base as &$config ) {
|
||||
// Skip uncombinables
|
||||
if ( $this->Combine->checkUncombinables( $config['parts'] ) ) {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
continue 2;
|
||||
}
|
||||
// Might not have verticals
|
||||
else if ( $config['parts'] === '' ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Each position needs a value
|
||||
switch ( count( $config['parts'] ) ) {
|
||||
case 1:
|
||||
$config['pos']['top-left'] = $config['pos']['top-right'] = $config['parts'][ 0 ];
|
||||
$config['pos']['bottom-left'] = $config['pos']['bottom-right'] = $config['parts'][ 0 ];
|
||||
break;
|
||||
case 2:
|
||||
$config['pos']['top-left'] = $config['pos']['bottom-right'] = $config['parts'][ 0 ];
|
||||
$config['pos']['bottom-left'] = $config['pos']['top-right'] = $config['parts'][ 1 ];
|
||||
break;
|
||||
case 3:
|
||||
$config['pos']['top-left'] = $config['parts'][ 0 ];
|
||||
$config['pos']['bottom-left'] = $config['pos']['top-right'] = $config['parts'][ 1 ];
|
||||
$config['pos']['bottom-right'] = $config['parts'][ 2 ];
|
||||
break;
|
||||
case 4:
|
||||
$config['pos']['top-left'] = $config['parts'][ 0 ];
|
||||
$config['pos']['top-right'] = $config['parts'][ 1 ];
|
||||
$config['pos']['bottom-right'] = $config['parts'][ 2 ];
|
||||
$config['pos']['bottom-left'] = $config['parts'][ 3 ];
|
||||
break;
|
||||
default:
|
||||
continue 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Build the replacement
|
||||
foreach ( $positions as $p => $v ) {
|
||||
if ( $regex['mod'] == '-moz-' ) {
|
||||
$replace .= "-moz-border-radius-" . preg_replace( "/-/", '', $p ) . ":"
|
||||
. $base['horizontal']['pos'][ $p ]
|
||||
. ( $base['vertical']['parts'] === '' ? '' : ' ' . $base['vertical']['pos'][ $p ] )
|
||||
. ';';
|
||||
}
|
||||
else {
|
||||
$replace .= $regex['mod'] . "border-$p-radius:"
|
||||
. $base['horizontal']['pos'][ $p ]
|
||||
. ( $base['vertical']['parts'] === '' ? '' : ' ' . $base['vertical']['pos'][ $p ] )
|
||||
. ';';
|
||||
}
|
||||
}
|
||||
$pos += strlen( $replace );
|
||||
$val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the storage object for border radius props
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
* @param (array) regex: Current border radius type checking props
|
||||
*/
|
||||
private function storage( $val, $regex ) {
|
||||
$storage = array(
|
||||
'horizontal' => array( 'replace' => '' ),
|
||||
'vertical' => array( 'replace' => '', 'keep' => false ),
|
||||
);
|
||||
|
||||
// Find all possible occurences of this border-radius type and mark their directional value
|
||||
$pos = 0;
|
||||
while ( preg_match( $regex['full'], $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
$parts = preg_split( $this->rspace, $match[ 4 ][ 0 ], 2 );
|
||||
$storage['horizontal'][ $match[ 2 ][ 0 ] . '-' . $match[ 3 ][ 0 ] ] = trim( $parts[ 0 ] );
|
||||
if ( isset( $parts[ 1 ] ) ) {
|
||||
$storage['vertical'][ $match[ 2 ][ 0 ] . '-' . $match[ 3 ][ 0 ] ] = trim( $parts[ 1 ] );
|
||||
$storage['vertical']['keep'] = true;
|
||||
$storage['vertical']['replace'] = '/';
|
||||
}
|
||||
else {
|
||||
$storage['vertical'][ $match[ 2 ][ 0 ] . '-' . $match[ 3 ][ 0 ] ] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
// Only combine if all 4 definitions are found (5 including replace)
|
||||
if ( count( $storage['horizontal'] ) != 5 ||
|
||||
$this->Combine->checkUncombinables( $storage['horizontal'] ) ||
|
||||
$this->Combine->checkUncombinables( $storage['vertical'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in BorderRadius Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,125 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine_Font
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Combine: Combine Controller
|
||||
* @param (regex) rfont: Font matching
|
||||
* @param (array) groupings: Set of font combinationals
|
||||
*/
|
||||
private $Control;
|
||||
private $Combine;
|
||||
private $rfont = "/(^|(?<!\\\);)(font|line)-(style|variant|weight|size|height|family):(.*?)((?<!\\\);|$)/";
|
||||
private $groupings = array(
|
||||
array( 'font-style', 'font-variant', 'font-weight', 'size/height', 'font-family' ),
|
||||
array( 'font-style', 'font-variant', 'font-weight', 'font-size', 'font-family' ),
|
||||
array( 'font-style', 'font-variant', 'size/height', 'font-family' ),
|
||||
array( 'font-style', 'font-variant', 'font-size', 'font-family' ),
|
||||
array( 'font-style', 'font-weight', 'size/height', 'font-family' ),
|
||||
array( 'font-style', 'font-weight', 'font-size', 'font-family' ),
|
||||
array( 'font-variant', 'font-weight', 'size/height', 'font-family' ),
|
||||
array( 'font-variant', 'font-weight', 'font-size', 'font-family' ),
|
||||
array( 'font-weight', 'size/height', 'font-family' ),
|
||||
array( 'font-weight', 'font-size', 'font-family' ),
|
||||
array( 'font-variant', 'size/height', 'font-family' ),
|
||||
array( 'font-variant', 'font-size', 'font-family' ),
|
||||
array( 'font-style', 'size/height', 'font-family' ),
|
||||
array( 'font-style', 'font-size', 'font-family' ),
|
||||
array( 'size/height', 'font-family' ),
|
||||
array( 'font-size', 'font-family' ),
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller & combiner
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
* @param (class) combine: CSSCompression Combiner
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
||||
$this->Control = $control;
|
||||
$this->Combine = $combine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines multiple font-definitions into single definition
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
public function combine( $val ) {
|
||||
$storage = $this->storage( $val );
|
||||
|
||||
// Loop through each property check and see if they can be replaced
|
||||
foreach ( $this->groupings as $props ) {
|
||||
if ( $replace = $this->Combine->searchDefinitions( 'font', $storage, $props ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If replacement string found, run it on all declarations
|
||||
if ( $replace ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rfont, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
if ( ! isset( $storage['line-height'] ) && stripos( $match[ 0 ][ 0 ], 'line-height') === 0 ) {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
continue;
|
||||
}
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
|
||||
$replace = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a storage object for iteration
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
private function storage( $val ) {
|
||||
$storage = array();
|
||||
|
||||
// Find all possible occurences and build the replacement
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rfont, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$storage[ $match[ 2 ][ 0 ] . '-' . $match[ 3 ][ 0 ] ] = $match[ 4 ][ 0 ];
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
|
||||
// Combine font-size & line-height if possible
|
||||
if ( isset( $storage['font-size'] ) && isset( $storage['line-height'] ) ) {
|
||||
$storage['size/height'] = $storage['font-size'] . '/' . $storage['line-height'];
|
||||
unset( $storage['font-size'], $storage['line-height'] );
|
||||
}
|
||||
|
||||
return $storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Font Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,104 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine_List
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Combine: Combine Controller
|
||||
* @param (regex) rlist: List style matching
|
||||
* @param (array) groupings: Group of list combinationals
|
||||
*/
|
||||
private $Control;
|
||||
private $Combine;
|
||||
private $rlist = "/(^|(?<!\\\);)list-style-(type|position|image):(.*?)((?<!\\\);|$)/";
|
||||
private $groupings = array(
|
||||
array( 'type', 'position', 'image' ),
|
||||
array( 'type', 'position' ),
|
||||
array( 'type', 'image' ),
|
||||
array( 'position', 'image' ),
|
||||
array( 'type' ),
|
||||
array( 'position' ),
|
||||
array( 'image' ),
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller & combiner
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
* @param (class) combine: CSSCompression Combiner
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
||||
$this->Control = $control;
|
||||
$this->Combine = $combine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines multiple list style props into single definition
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
public function combine( $val ) {
|
||||
// If replacement string found, run it on all declarations
|
||||
if ( ( $replace = $this->replace( $val ) ) !== false ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rlist, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
|
||||
$replace = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the replacement string for list props
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
private function replace( $val ) {
|
||||
$storage = array();
|
||||
$pos = 0;
|
||||
|
||||
// Find all possible occurences and build the replacement
|
||||
while ( preg_match( $this->rlist, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$storage[ $match[ 2 ][ 0 ] ] = $match[ 3 ][ 0 ];
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
|
||||
// Run background checks and get replacement str
|
||||
foreach ( $this->groupings as $props ) {
|
||||
if ( $replace = $this->Combine->searchDefinitions( 'list-style', $storage, $props ) ) {
|
||||
return $replace;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in List Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,190 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Combine_MarginPadding
|
||||
{
|
||||
/**
|
||||
* Combine Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Combine: Combine Controller
|
||||
* @param (regex) rspace: Checks for space without an escape '\' character before it
|
||||
* @param (regex) rmp: Margin/Padding matching
|
||||
* @param (regex) rmpbase: Margin/Padding base match
|
||||
*/
|
||||
private $Control;
|
||||
private $Combine;
|
||||
private $rspace = "/(?<!\\\)\s/";
|
||||
private $rmp = "/(^|(?<!\\\);)(margin|padding)-(top|right|bottom|left):(.*?)((?<!\\\);|$)/";
|
||||
private $rmpbase = "/(^|(?<!\\\);)(margin|padding):(.*?)((?<!\\\);|$)/";
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller & combiner
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
* @param (class) combine: CSSCompression Combiner
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
||||
$this->Control = $control;
|
||||
$this->Combine = $combine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines multiple directional properties of
|
||||
* margin/padding into single definition.
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
public function combine( $val ) {
|
||||
$val = $this->expand( $val );
|
||||
$storage = $this->storage( $val );
|
||||
$pos = 0;
|
||||
|
||||
// Now rebuild the string replacing all instances of margin/padding if shorthand exists
|
||||
while ( preg_match( $this->rmp, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$prop = $match[ 2 ][ 0 ];
|
||||
if ( isset( $storage[ $prop ] ) ) {
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $storage[ $prop ], $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $storage[ $prop ] ) - $colon - 1;
|
||||
$storage[ $prop ] = '';
|
||||
}
|
||||
else {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Return converted val
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the storage object for iteration
|
||||
*
|
||||
* @param (string) val: Rule Set
|
||||
*/
|
||||
private function storage( $val ) {
|
||||
$storage = array();
|
||||
$pos = 0;
|
||||
|
||||
// Find all possible occurences of margin/padding and mark their directional value
|
||||
while ( preg_match( $this->rmp, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
if ( ! isset( $storage[ $match[ 2 ][ 0 ] ] ) ) {
|
||||
$storage[ $match[ 2 ][ 0 ] ] = array( $match[ 3 ][ 0 ] => $match[ 4 ][ 0 ] );
|
||||
}
|
||||
|
||||
// Override double written properties
|
||||
$storage[ $match[ 2 ][ 0 ] ][ $match[ 3 ][ 0 ] ] = $match[ 4 ][ 0 ];
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
||||
}
|
||||
|
||||
// Go through each tag for possible combination
|
||||
foreach ( $storage as $tag => $arr ) {
|
||||
// Only combine if all 4 definitions are found
|
||||
if ( count( $arr ) == 4 && ! $this->Combine->checkUncombinables( $arr ) ) {
|
||||
// All 4 are the same
|
||||
if ( $arr['top'] == $arr['bottom'] && $arr['left'] == $arr['right'] && $arr['top'] == $arr['left'] ) {
|
||||
$storage[ $tag ] = "$tag:" . $arr['top'] . ';';
|
||||
}
|
||||
// Opposites are the same
|
||||
else if ( $arr['top'] == $arr['bottom'] && $arr['left'] == $arr['right'] ) {
|
||||
$storage[ $tag ] = "$tag:" . $arr['top'] . ' ' . $arr['left'] . ';';
|
||||
}
|
||||
// 3-point directional
|
||||
else if ( $arr['right'] == $arr['left'] ) {
|
||||
$storage[ $tag ] = "$tag:" . $arr['top'] . ' ' . $arr['right'] . ' ' . $arr['bottom'] . ';';
|
||||
}
|
||||
// none are the same, but can still use shorthand notation
|
||||
else {
|
||||
$storage[ $tag ] = "$tag:" . $arr['top'] . ' ' . $arr['right'] . ' ' . $arr['bottom'] . ' ' . $arr['left'] . ';';
|
||||
}
|
||||
}
|
||||
else {
|
||||
unset( $storage[ $tag ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Explodes shorthanded margin/padding properties for later combination
|
||||
*
|
||||
* @param (string) val: Rule set
|
||||
*/
|
||||
private function expand( $val ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rmpbase, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$replace = '';
|
||||
$prop = $match[ 2 ][ 0 ];
|
||||
$value = preg_split( $this->rspace, trim( $match[ 3 ][ 0 ] ) );
|
||||
$positions = array(
|
||||
'top' => 0,
|
||||
'right' => 0,
|
||||
'bottom' => 0,
|
||||
'left' => 0
|
||||
);
|
||||
|
||||
// Skip uncombinables
|
||||
if ( $this->Combine->checkUncombinables( $value ) ) {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Each position needs a value
|
||||
switch ( count( $value ) ) {
|
||||
case 1:
|
||||
$positions['top'] = $positions['right'] = $positions['bottom'] = $positions['left'] = $value[ 0 ];
|
||||
break;
|
||||
case 2:
|
||||
$positions['top'] = $positions['bottom'] = $value[ 0 ];
|
||||
$positions['right'] = $positions['left'] = $value[ 1 ];
|
||||
break;
|
||||
case 3:
|
||||
$positions['top'] = $value[ 0 ];
|
||||
$positions['right'] = $positions['left'] = $value[ 1 ];
|
||||
$positions['bottom'] = $value[ 2 ];
|
||||
break;
|
||||
case 4:
|
||||
$positions['top'] = $value[ 0 ];
|
||||
$positions['right'] = $value[ 1 ];
|
||||
$positions['bottom'] = $value[ 2 ];
|
||||
$positions['left'] = $value[ 3 ];
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
// Build the replacement
|
||||
foreach ( $positions as $p => $v ) {
|
||||
$replace .= "$prop-$p:$v;";
|
||||
}
|
||||
$colon = strlen( $match[ 1 ][ 0 ] );
|
||||
$val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in MarginPadding Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,212 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Compress
|
||||
{
|
||||
/**
|
||||
* Trim Patterns
|
||||
*
|
||||
* @param (array) options: Reference to options
|
||||
* @param (array) stats: Reference to stats
|
||||
* @param (regex) rsemicolon: Checks for semicolon without an escape '\' character before it
|
||||
* @param (regex) rcolon: Checks for colon without an escape '\' character before it
|
||||
* @param (regex) rspace: Checks for space without an escape '\' character before it
|
||||
*/
|
||||
private $options = array();
|
||||
private $stats = array();
|
||||
private $rsemicolon = "/(?<!\\\);/";
|
||||
private $rcolon = "/(?<!\\\):/";
|
||||
private $rspace = "/(?<!\\\)\s/";
|
||||
|
||||
/**
|
||||
* Other inner classes that get used within compression
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Trim: Trim Instance
|
||||
* @class Setup: Setup Instance
|
||||
* @class Format: Formatting Instance
|
||||
* @class Combine: Combine Instance
|
||||
* @class Cleanup: Cleanup Instance
|
||||
* @class Organize: Organize Instance
|
||||
* @class Selectors: Selectors Instance
|
||||
* @param (array) others: List of above classes for copying
|
||||
*/
|
||||
private $Control;
|
||||
private $Trim;
|
||||
private $Setup;
|
||||
private $Format;
|
||||
private $Combine;
|
||||
private $Cleanup;
|
||||
private $Organize;
|
||||
private $Selectors;
|
||||
private $others = array(
|
||||
'Trim',
|
||||
'Setup',
|
||||
'Format',
|
||||
'Combine',
|
||||
'Cleanup',
|
||||
'Organize',
|
||||
'Selectors',
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->options = &$control->Option->options;
|
||||
$this->stats = &$control->stats;
|
||||
|
||||
foreach ( $this->others as $class ) {
|
||||
$this->$class = $control->$class;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Centralized function to run css compression.
|
||||
*
|
||||
* @param (string) css: Stylesheet to compresss
|
||||
*/
|
||||
public function compress( $css ) {
|
||||
$setup = $this->setup( $css );
|
||||
$setup = $this->rulesets( $setup );
|
||||
$css = $this->readability( $setup );
|
||||
|
||||
// Attach plea to top of page with unknown blocks
|
||||
if ( $this->options['add-unknown'] && count( $setup['unknown'] ) ) {
|
||||
$css = "/*\nThere are unknown blocks in the sheet, please please please open an issue with your sheet attached to it:\n"
|
||||
. "https://github.com/codenothing/css-compressor/issues\n"
|
||||
. "Thank You --\n\n"
|
||||
. implode( "\n", $setup['unknown'] )
|
||||
. "\n*/\n"
|
||||
. $css;
|
||||
}
|
||||
|
||||
// Mark final file size
|
||||
$this->stats['after']['size'] = strlen( $css = trim( $css ) );
|
||||
|
||||
// Return compressed css
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs css through initial setup handlers
|
||||
*
|
||||
* @param (string) css: Sheet to compress
|
||||
*/
|
||||
private function setup( $css ) {
|
||||
// Initial stats
|
||||
$this->stats['before']['time'] = microtime( true );
|
||||
$this->stats['before']['size'] = strlen( $css );
|
||||
|
||||
// Initial trimming
|
||||
$css = $this->Trim->trim( $css );
|
||||
|
||||
// Do a little tokenizing, compress each property individually
|
||||
$setup = $this->Setup->setup( $css );
|
||||
|
||||
// Mark number of selectors pre-combine
|
||||
$this->stats['before']['selectors'] = count( $setup['selectors'] );
|
||||
|
||||
return $setup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Focus compressions on each rule set
|
||||
*
|
||||
* @param (array) setup: Array containing selectors and rule sets
|
||||
*/
|
||||
private function rulesets( $setup ) {
|
||||
// Do selector specific compressions
|
||||
$this->Selectors->selectors( $setup['selectors'] );
|
||||
|
||||
// Look at each group of properties as a whole, and compress/combine similiar definitions
|
||||
$this->Combine->combine( $setup['selectors'], $setup['details'] );
|
||||
|
||||
// If order isn't important, run comination functions before and after compressions to catch all instances
|
||||
// Be sure to prune before hand for higher chance of matching
|
||||
if ( $this->options['organize'] ) {
|
||||
$this->Cleanup->cleanup( $setup['selectors'], $setup['details'] );
|
||||
$this->Organize->organize( $setup['selectors'], $setup['details'] );
|
||||
$this->Combine->combine( $setup['selectors'], $setup['details'] );
|
||||
}
|
||||
|
||||
// Do final maintenace work, remove injected property/values
|
||||
$this->Cleanup->cleanup( $setup['selectors'], $setup['details'] );
|
||||
|
||||
// Run final counters before full cleanup
|
||||
$this->finalCount( $setup['selectors'], $setup['details'] );
|
||||
|
||||
return $setup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs final counts on selectors and props
|
||||
*
|
||||
* @param (array) selectors: Selector rules
|
||||
* @param (array) details: Rule sets
|
||||
*/
|
||||
private function finalCount( $selectors, $details ) {
|
||||
// Selectors and props
|
||||
$this->stats['after']['selectors'] = count( $selectors );
|
||||
foreach ( $details as $item ) {
|
||||
$props = preg_split( $this->rsemicolon, $item );
|
||||
|
||||
// Make sure count is true
|
||||
foreach ( $props as $k => $v ) {
|
||||
if ( ! isset( $v ) || $v == '' ) {
|
||||
unset( $props[ $k ] );
|
||||
}
|
||||
}
|
||||
$this->stats['after']['props'] += count( $props );
|
||||
}
|
||||
|
||||
// Final count for stats
|
||||
$this->stats['after']['time'] = microtime( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the compressed rule sets into a stylesheet
|
||||
*
|
||||
* @param (array) setup: Array containing selectors and rule sets
|
||||
*/
|
||||
private function readability( $setup ) {
|
||||
// Format css to users preference
|
||||
$css = $this->Format->readability( $this->options['readability'], $setup['selectors'], $setup['details'] );
|
||||
|
||||
// Intros
|
||||
foreach ( $setup as $value ) {
|
||||
if ( $value && is_string( $value ) ) {
|
||||
$css = $value . $css;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove escapables
|
||||
$css = $this->Cleanup->removeInjections( $css );
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Compress Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,236 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Control
|
||||
{
|
||||
/**
|
||||
* Control Patterns
|
||||
*
|
||||
* @param (string) css: Holds compressed css string
|
||||
* @param (string) mode: Current compression mode state
|
||||
* @param (array) stats: Holds compression stats
|
||||
* @param (array) getters: Array of accessible getters
|
||||
*/
|
||||
public $css = '';
|
||||
public $mode = '';
|
||||
public $stats = array();
|
||||
private $getters = array(
|
||||
'css',
|
||||
'mode',
|
||||
'stats',
|
||||
);
|
||||
|
||||
/**
|
||||
* Subclasses that do the ground work for this compressor
|
||||
*
|
||||
* @class CSSCompression: Public facing compression class
|
||||
* @class Option: Option handling
|
||||
* @class Trim: Does the initial trimming for the css
|
||||
* @class Format: Formats the output
|
||||
* @class Numeric: Handles numeric compression
|
||||
* @class Color: Handles color compression
|
||||
* @class Individuals: Runs compression algorithms on individual properties and values
|
||||
* @class Selectors: Runs selector specific compressions
|
||||
* @class Combine: Handles combining of various properties
|
||||
* @class Organize: Reorganizes the sheet for futher compression
|
||||
* @class Cleanup: Cleans out all injected characters during compression
|
||||
* @class Compress: Central compression unit.
|
||||
* @param (array) subclasses: Array holding all the subclasses for inlusion
|
||||
*/
|
||||
public $CSSCompression;
|
||||
public $Option;
|
||||
public $Trim;
|
||||
public $Format;
|
||||
public $Numeric;
|
||||
public $Color;
|
||||
public $Individuals;
|
||||
public $Selectors;
|
||||
public $Combine;
|
||||
public $Organize;
|
||||
public $Cleanup;
|
||||
public $Setup;
|
||||
public $Compress;
|
||||
private $subclasses = array(
|
||||
'Option',
|
||||
'Trim',
|
||||
'Format',
|
||||
'Numeric',
|
||||
'Color',
|
||||
'Individuals',
|
||||
'Selectors',
|
||||
'Combine',
|
||||
'Organize',
|
||||
'Cleanup',
|
||||
'Setup',
|
||||
'Compress',
|
||||
);
|
||||
|
||||
/**
|
||||
* Pull in the Compression instance and build the subclasses
|
||||
*
|
||||
* @param (class) CSSCompression: CSSCompression Instance
|
||||
*/
|
||||
public function __construct( CSSCompression $CSSCompression ) {
|
||||
$this->CSSCompression = $CSSCompression;
|
||||
|
||||
// Load all subclasses on demand
|
||||
if ( ! class_exists( "CSSCompression_Option", false ) ) {
|
||||
$path = dirname(__FILE__) . '/';
|
||||
foreach ( $this->subclasses as $class ) {
|
||||
require( $path . $class . '.php' );
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize each subclass
|
||||
foreach ( $this->subclasses as $class ) {
|
||||
$full = "CSSCompression_$class";
|
||||
$this->$class = new $full( $this );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Control access to properties
|
||||
*
|
||||
* - Getting stats/mode/css returns the current value of that property
|
||||
* - Getting options will return the current full options array
|
||||
* - Getting anything else returns that current value in the options array or NULL
|
||||
*
|
||||
* @param (string) name: Name of property that you want to access
|
||||
*/
|
||||
public function get( $name ) {
|
||||
if ( in_array( $name, $this->getters ) ) {
|
||||
return $this->$name;
|
||||
}
|
||||
else if ( $name == 'options' ) {
|
||||
return $this->Option->options;
|
||||
}
|
||||
else {
|
||||
return $this->Option->option( $name );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The setter method only allows access to setting values in the options array
|
||||
*
|
||||
* @param (string) name: Key name of the option you want to set
|
||||
* @param (mixed) value: Value of the option you want to set
|
||||
*/
|
||||
public function set( $name, $value ) {
|
||||
// Allow for passing array of options to merge into current ones
|
||||
if ( $name === 'options' && is_array( $value ) ) {
|
||||
return $this->Option->merge( $value );
|
||||
}
|
||||
else if ( isset( CSSCompression::$defaults[ $name ] ) ) {
|
||||
return $this->Option->option( $name, $value );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Invalid Private Access to $name in CSSCompression." );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges a predefined set options
|
||||
*
|
||||
* @param (string) mode: Name of mode to use.
|
||||
*/
|
||||
public function mode( $mode = NULL ) {
|
||||
return $this->Options->merge( $mode );
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets options to their defaults, and flushes out variables
|
||||
*
|
||||
* @params none
|
||||
*/
|
||||
public function reset(){
|
||||
$this->Option->reset();
|
||||
return $this->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans out class variables for next run
|
||||
*
|
||||
* @params none
|
||||
*/
|
||||
public function flush(){
|
||||
$this->css = '';
|
||||
$this->stats = array(
|
||||
'before' => array(
|
||||
'props' => 0,
|
||||
'selectors' => 0,
|
||||
'size' => 0,
|
||||
'time' => 0,
|
||||
),
|
||||
'after' => array(
|
||||
'props' => 0,
|
||||
'selectors' => 0,
|
||||
'size' => 0,
|
||||
'time' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy to run Compression on the sheet passed. Handle options here.
|
||||
*
|
||||
* @param (string) css: Stylesheet to be compressed
|
||||
* @param (mixed) options: Array of options or mode to use.
|
||||
*/
|
||||
public function compress( $css = NULL, $options = NULL ) {
|
||||
// Flush out old stats and variables
|
||||
$this->flush();
|
||||
|
||||
// If no additional options, just run compression
|
||||
if ( $options === NULL ) {
|
||||
return $this->css = $this->Compress->compress( $css );
|
||||
}
|
||||
|
||||
// Store old params
|
||||
$old = $this->mode == '__custom' ? $this->Option->option() : $this->mode;
|
||||
$readability = $this->Option->option( 'readability' );
|
||||
|
||||
// Compress with new set of options
|
||||
$this->Option->merge( $options );
|
||||
$css = $this->Compress->compress( $css );
|
||||
|
||||
// Reset original options
|
||||
$this->reset();
|
||||
$this->Option->merge( $old );
|
||||
|
||||
// Return the compressed css
|
||||
return $this->css = $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Backdoor access to subclasses
|
||||
* ONLY FOR DEVELOPMENT/TESTING.
|
||||
*
|
||||
* @param (string) class: Name of the focus class
|
||||
* @param (array) config: Contains name reference and test arguments
|
||||
*/
|
||||
public function access( $class, $method, $args ) {
|
||||
if ( $class == 'Control' ) {
|
||||
return call_user_func_array( array( $class, $method ), $args );
|
||||
}
|
||||
else if ( strpos( $class, '.' ) !== false ) {
|
||||
$parts = explode( '.', $class );
|
||||
$class = $parts[ 0 ];
|
||||
$subclass = $parts[ 1 ];
|
||||
return $this->$class->access( $subclass, $method, $args );
|
||||
}
|
||||
else if ( in_array( $class, $this->subclasses ) ) {
|
||||
return $this->$class->access( $method, $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown Class Access - " . $class );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
|
||||
Class CSSCompression_Exception extends Exception
|
||||
{
|
||||
/**
|
||||
* Custom exception handler
|
||||
*
|
||||
* @param (string) message: Error message
|
||||
* @param (int) code: Error code
|
||||
* @instance (Exception Instance) previous: Previous exception
|
||||
*/
|
||||
public function __construct( $message = 'Unknown Exception', $code = 0, Exception $previous = NULL ) {
|
||||
parent::__construct( $message, $code, $previous );
|
||||
}
|
||||
|
||||
/**
|
||||
* String version of this custom exception
|
||||
*
|
||||
* @params none
|
||||
*/
|
||||
public function __toString(){
|
||||
return "CSSCompression Exception: [" . $this->code . "] " . $this->message . "\n";
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,187 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Format
|
||||
{
|
||||
/**
|
||||
* Format Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (string) token: Copy of the injection token
|
||||
* @param (array) options: Reference to options
|
||||
* @param (regex) rsemicolon: Checks for semicolon without an escape '\' character before it
|
||||
* @param (regex) rcolon: Checks for colon without an escape '\' character before it
|
||||
* @param (array) readability: Mapping to readability functions
|
||||
*/
|
||||
private $Control;
|
||||
private $token = '';
|
||||
private $options = array();
|
||||
private $rsemicolon = "/(?<!\\\);/";
|
||||
private $rcolon = "/(?<!\\\):/";
|
||||
private $readability = array(
|
||||
CSSCompression::READ_MAX => 'maximum',
|
||||
CSSCompression::READ_MED => 'medium',
|
||||
CSSCompression::READ_MIN => 'minimum',
|
||||
CSSCompression::READ_NONE => 'none',
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->token = CSSCompression::TOKEN;
|
||||
$this->options = &$control->Option->options;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reformats compressed CSS into specified format
|
||||
*
|
||||
* @param (int) readability: Readability level of compressed output
|
||||
* @param (array) selectors: Array of selectors
|
||||
* @param (array) details: Array of declarations
|
||||
*/
|
||||
public function readability( $readability = CSSCompression::READ_NONE, $selectors = array(), $details = array() ) {
|
||||
if ( isset( $this->readability[ $readability ] ) ) {
|
||||
$fn = $this->readability[ $readability ];
|
||||
return trim( $this->$fn( $selectors, $details ) );
|
||||
}
|
||||
else {
|
||||
return 'Invalid Readability Value';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns maxium readability, breaking on every selector, brace, and property
|
||||
*
|
||||
* @param (array) selectors: Array of selectors
|
||||
* @param (array) details: Array of declarations
|
||||
*/
|
||||
private function maximum( $selectors, $details ) {
|
||||
$css = '';
|
||||
foreach ( $selectors as $k => $v ) {
|
||||
if ( strpos( $v, $this->token ) === 0 ) {
|
||||
$css .= substr( $v, strlen( $this->token ) );
|
||||
$css .= $details[ $k ];
|
||||
continue;
|
||||
}
|
||||
else if ( ! $details[ $k ] || trim( $details[ $k ] ) == '' ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$v = str_replace( '>', ' > ', $v );
|
||||
$v = str_replace( '+', ' + ', $v );
|
||||
$v = str_replace( ',', ', ', $v );
|
||||
$css .= "$v {\n";
|
||||
$arr = preg_split( $this->rsemicolon, $details[ $k ] );
|
||||
|
||||
foreach ( $arr as $item ) {
|
||||
if ( ! $item ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
list( $prop, $val ) = preg_split( $this->rcolon, $item, 2 );
|
||||
$css .= "\t$prop: $val;\n";
|
||||
}
|
||||
|
||||
// Kill that last semicolon at users request
|
||||
if ( $this->options['unnecessary-semicolons'] ) {
|
||||
$css = preg_replace( "/;\n$/", "\n", $css );
|
||||
}
|
||||
|
||||
$css .= "}\n\n";
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns medium readability, putting selectors and rule sets on new lines
|
||||
*
|
||||
* @param (array) selectors: Array of selectors
|
||||
* @param (array) details: Array of declarations
|
||||
*/
|
||||
private function medium( $selectors, $details ) {
|
||||
$css = '';
|
||||
foreach ( $selectors as $k => $v ) {
|
||||
if ( strpos( $v, $this->token ) === 0 ) {
|
||||
$css .= substr( $v, strlen( $this->token ) );
|
||||
$css .= $details[ $k ];
|
||||
continue;
|
||||
}
|
||||
else if ( $details[ $k ] && $details[ $k ] != '' ) {
|
||||
$css .= "$v {\n\t" . $details[ $k ] . "\n}\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns minimum readability, breaking after every selector and it's rule set
|
||||
*
|
||||
* @param (array) selectors: Array of selectors
|
||||
* @param (array) details: Array of declarations
|
||||
*/
|
||||
private function minimum( $selectors, $details ) {
|
||||
$css = '';
|
||||
foreach ( $selectors as $k => $v ) {
|
||||
if ( strpos( $v, $this->token ) === 0 ) {
|
||||
$css .= substr( $v, strlen( $this->token ) );
|
||||
$css .= $details[ $k ];
|
||||
continue;
|
||||
}
|
||||
else if ( $details[ $k ] && $details[ $k ] != '' ) {
|
||||
$css .= "$v{" . $details[ $k ] . "}\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unreadable, but fully compressed script
|
||||
*
|
||||
* @param (array) selectors: Array of selectors
|
||||
* @param (array) details: Array of declarations
|
||||
*/
|
||||
private function none( $selectors, $details ) {
|
||||
$css = '';
|
||||
foreach ( $selectors as $k => $v ) {
|
||||
if ( strpos( $v, $this->token ) === 0 ) {
|
||||
$css .= substr( $v, strlen( $this->token ) );
|
||||
$css .= $details[ $k ];
|
||||
continue;
|
||||
}
|
||||
else if ( $details[ $k ] && $details[ $k ] != '' ) {
|
||||
$css .= trim( "$v{" . $details[ $k ] . "}" );
|
||||
}
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Format Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,307 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Individuals
|
||||
{
|
||||
/**
|
||||
* Individual patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Numeric: Numeric handler
|
||||
* @class Color: Color Handler
|
||||
* @param (array) options: Reference to options
|
||||
* @param (regex) rdirectional: Properties that may have multiple directions
|
||||
* @param (regex) rborderradius: Checks property for border-radius declaration
|
||||
* @param (regex) rnoneprop: Properties that can have none as their value(will be converted to 0)
|
||||
* @param (regex) rclip: Looks for rect grouping in clip declaration
|
||||
* @param (regex) rsplitter: Checks font properties for font-size/line-height split
|
||||
* @param (regex) rfilter: Special alpha filter for msie
|
||||
* @param (regex) rspace: Checks for unescaped space
|
||||
* @param (regex) rspace: Checks for unescaped slash
|
||||
* @param (array) weights: Array of font-weight name conversions to their numeric counterpart
|
||||
*/
|
||||
private $Control;
|
||||
private $Numeric;
|
||||
private $Color;
|
||||
private $options = array();
|
||||
private $rdirectional = "/^(margin|padding|border-spacing)$/";
|
||||
private $rborderradius = "/border[a-z-]*radius/";
|
||||
private $rradiusfull = "/^(-moz-|-webkit-)?border-radius$/";
|
||||
private $rnoneprop = "/^(border|background|border-(top|right|bottom|left))$/";
|
||||
private $rclip = "/^rect\(\s*(\-?\d*\.?\d*?\w*)(,|\s)(\-?\d*\.?\d*?\w*)(,|\s)(\-?\d*\.?\d*?\w*)(,|\s)(\-?\d*\.?\d*?\w*)\s*\)$/";
|
||||
private $rsplitter = "/(^|(?<!\\\)\s)([^\/ ]+)\/([^\/ ]+)((?<!\\\)\s|$)/";
|
||||
private $rfilter = "/[\"']?PROGID\\\?:DXImageTransform\\\?.Microsoft\\\?.Alpha\(Opacity\\\?=(\d+\\\?\.?\d*)\)[\"']?/i";
|
||||
private $rspace = "/(?<!\\\)\s/";
|
||||
private $rslash = "/(?<!\\\)\//";
|
||||
private $weights = array(
|
||||
"normal" => 400,
|
||||
"bold" => 700,
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->Numeric = $control->Numeric;
|
||||
$this->Color = $control->Color;
|
||||
$this->options = &$control->Option->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs special unit/directional compressions
|
||||
*
|
||||
* @param (string) prop: CSS Property
|
||||
* @param (string) val: Value of CSS Property
|
||||
*/
|
||||
public function individuals( $prop, $val ) {
|
||||
// Properties should always be lowercase
|
||||
$prop = strtolower( $prop );
|
||||
|
||||
// Split up each definiton for color and numeric compressions
|
||||
$parts = preg_split( $this->rspace, $val );
|
||||
foreach ( $parts as &$v ) {
|
||||
if ( ! $v || $v == '' ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove uneeded decimals/units
|
||||
if ( $this->options['format-units'] ) {
|
||||
$v = $this->Numeric->numeric( $v );
|
||||
}
|
||||
|
||||
// Color compression
|
||||
$v = $this->Color->color( $v );
|
||||
}
|
||||
$val = trim( implode( ' ', $parts ) );
|
||||
|
||||
// Special border radius handling
|
||||
if ( preg_match( $this->rborderradius, $prop ) ) {
|
||||
$val = $this->borderRadius( $prop, $val );
|
||||
}
|
||||
// Remove uneeded side definitions if possible
|
||||
else if ( $this->options['directional-compress'] && count( $parts ) > 1 && preg_match( $this->rdirectional, $prop ) ) {
|
||||
$val = $this->directionals( strtolower( $val ) );
|
||||
}
|
||||
|
||||
// Font-weight converter
|
||||
if ( $this->options['fontweight2num'] && ( $prop == 'font-weight' || $prop == 'font' ) ) {
|
||||
$val = $this->fontweight( $val );
|
||||
}
|
||||
|
||||
// Special font value conversions
|
||||
if ( $prop == 'font' ) {
|
||||
$val = $this->font( $val );
|
||||
}
|
||||
|
||||
// Special clip value compressions
|
||||
if ( $prop == 'clip' ) {
|
||||
$val = $this->clip( $val );
|
||||
}
|
||||
|
||||
// None to 0 converter
|
||||
$val = $this->none( $prop, $val );
|
||||
|
||||
// MSIE Filters
|
||||
$val = $this->filter( $prop, $val );
|
||||
|
||||
// Return for list retrival
|
||||
return array( $prop, $val );
|
||||
}
|
||||
|
||||
/**
|
||||
* Preps border radius for directional compression
|
||||
*
|
||||
* @param (string) prop: Property Declaration
|
||||
* @param (string) val: Declaration Value
|
||||
*/
|
||||
private function borderRadius( $prop, $val ) {
|
||||
if ( preg_match( $this->rslash, $val ) ) {
|
||||
$parts = preg_split( $this->rslash, $val, 2 );
|
||||
// We have to redo numeric compression because the slash may hav intruded
|
||||
foreach ( $parts as &$row ) {
|
||||
$p = preg_split( $this->rspace, $row );
|
||||
foreach ( $p as &$v ) {
|
||||
if ( ! $v || $v == '' ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove uneeded decimals/units
|
||||
if ( $this->options['format-units'] ) {
|
||||
$v = $this->Numeric->numeric( $v );
|
||||
}
|
||||
}
|
||||
$row = implode( ' ', $p );
|
||||
if ( $this->options['directional-compress'] ) {
|
||||
$row = $this->directionals( strtolower( $row ) );
|
||||
}
|
||||
}
|
||||
$val = implode( '/', $parts );
|
||||
}
|
||||
else if ( $this->options['directional-compress'] && preg_match( $this->rradiusfull, $prop ) ) {
|
||||
$val = $this->directionals( strtolower( $val ) );
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds directional compression on methods like margin/padding
|
||||
*
|
||||
* @param (string) val: Value of CSS Property
|
||||
*/
|
||||
private function directionals( $val ) {
|
||||
// Split up each definiton
|
||||
$direction = preg_split( $this->rspace, $val );
|
||||
|
||||
// 4 Direction reduction
|
||||
$count = count( $direction );
|
||||
if ( $count == 4 ) {
|
||||
// All 4 sides are the same, combine into 1 definition
|
||||
if ( $direction[ 0 ] == $direction[ 1 ] && $direction[ 2 ] == $direction[ 3 ] && $direction[ 0 ] == $direction[ 3 ] ) {
|
||||
$direction = array( $direction[ 0 ] );
|
||||
}
|
||||
// top-bottom/left-right are the same, reduce definition
|
||||
else if ( $direction[ 0 ] == $direction[ 2 ] && $direction[ 1 ] == $direction[ 3 ] ) {
|
||||
$direction = array( $direction[ 0 ], $direction[ 1 ] );
|
||||
}
|
||||
// Only left-right are the same
|
||||
else if ( $direction[ 1 ] == $direction[ 3 ] ) {
|
||||
$direction = array( $direction[ 0 ], $direction[ 1 ], $direction[ 2 ] );
|
||||
}
|
||||
}
|
||||
// 3 Direction reduction
|
||||
else if ( $count == 3 ) {
|
||||
// All directions are the same
|
||||
if ( $direction[ 0 ] == $direction[ 1 ] && $direction[ 1 ] == $direction[ 2 ] ) {
|
||||
$direction = array( $direction[ 0 ] );
|
||||
}
|
||||
// Only top(first) and bottom(last) are the same
|
||||
else if ( $direction[ 0 ] == $direction[ 2 ] ) {
|
||||
$direction = array( $direction[ 0 ], $direction[ 1 ] );
|
||||
}
|
||||
}
|
||||
// 2 Direction reduction
|
||||
// Both directions are the same, combine into single definition
|
||||
else if ( $count == 2 && $direction[ 0 ] == $direction[ 1 ] ) {
|
||||
$direction = array( $direction[ 0 ] );
|
||||
}
|
||||
|
||||
// Return the combined version of the directions
|
||||
// Single entries will just return
|
||||
return implode( ' ', $direction );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts font-weight names to numbers
|
||||
*
|
||||
* @param (string) val: font-weight prop value
|
||||
*/
|
||||
private function fontweight( $val ) {
|
||||
if ( preg_match( $this->rspace, $val ) ) {
|
||||
$parts = preg_split( $this->rspace, $val );
|
||||
foreach ( $parts as &$item ) {
|
||||
$lower = strtolower( $item );
|
||||
if ( isset( $this->weights[ $lower ] ) && $lower != 'normal' ) {
|
||||
$item = $this->weights[ $lower ];
|
||||
}
|
||||
}
|
||||
$val = implode( ' ', $parts );
|
||||
}
|
||||
else if ( isset( $this->weights[ strtolower( $val ) ] ) ) {
|
||||
$val = $this->weights[ strtolower( $val ) ];
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Special font conversions
|
||||
*
|
||||
* @param (string) val: property value
|
||||
*/
|
||||
private function font( $val ) {
|
||||
// Split out the font-size/line-height split and run through numerical handlers
|
||||
if ( preg_match( $this->rsplitter, $val, $match, PREG_OFFSET_CAPTURE ) ) {
|
||||
$size = $this->Numeric->numeric( $match[ 2 ][ 0 ] );
|
||||
$height = $this->Numeric->numeric( $match[ 3 ][ 0 ] );
|
||||
$concat = $match[ 1 ][ 0 ] . $size . '/' . $height . $match[ 4 ][ 0 ];
|
||||
$val = substr_replace( $val, $concat, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Special clip conversions
|
||||
*
|
||||
* @param (string) val: property value
|
||||
*/
|
||||
private function clip( $val ) {
|
||||
if ( preg_match( $this->rclip, $val, $match ) ) {
|
||||
$positions = array( 1, 3, 5, 7 );
|
||||
$clean = 'rect(';
|
||||
foreach ( $positions as $pos ) {
|
||||
if ( ! isset( $match[ $pos ] ) ) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
$clean .= $this->Numeric->numeric( $match[ $pos ] ) . ( isset( $match[ $pos + 1 ] ) ? $match[ $pos + 1 ] : '' );
|
||||
}
|
||||
$val = $clean . ')';
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert none vals to 0
|
||||
*
|
||||
* @param (string) prop: Current Property
|
||||
* @param (string) val: property value
|
||||
*/
|
||||
private function none( $prop, $val ) {
|
||||
if ( preg_match( $this->rnoneprop, $prop ) && $val == 'none' ) {
|
||||
$val = '0';
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* MSIE Filter Conversion
|
||||
*
|
||||
* @param (string) prop: Current Property
|
||||
* @param (string) val: property value
|
||||
*/
|
||||
private function filter( $prop, $val ) {
|
||||
if ( preg_match( "/filter/", $prop ) ) {
|
||||
$val = preg_replace( $this->rfilter, "alpha(opacity=$1)", $val );
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Individuals Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Numeric
|
||||
{
|
||||
/**
|
||||
* Numeric Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (array) options: Reference to options
|
||||
* @param (regex) rdecimal: Checks for zero decimal
|
||||
* @param (regex) rzero: Checks for preceding 0 to decimal unit
|
||||
* @param (regex) runit: Checks for suffix on 0 unit
|
||||
*/
|
||||
private $Control;
|
||||
private $options = array();
|
||||
private $rdecimal = "/^(\+|\-)?(\d*\.[1-9]*0*)(\%|[a-z]{2})$/i";
|
||||
private $rzero = "/^(\+|\-)?0(\.\d+)(\%|[a-z]{2})?$/i";
|
||||
private $runit = "/^0(\%|[a-z]{2})$/i";
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->options = &$control->Option->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs all numeric operations
|
||||
*
|
||||
* @param (string) str: Unit string
|
||||
*/
|
||||
public function numeric( $str ) {
|
||||
$str = $this->decimal( $str );
|
||||
$str = $this->zeroes( $str );
|
||||
$str = $this->units( $str );
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove's unecessary decimal, ie 13.0px => 13px
|
||||
*
|
||||
* @param (string) str: Unit string
|
||||
*/
|
||||
private function decimal( $str ) {
|
||||
if ( preg_match( $this->rdecimal, $str, $match ) ) {
|
||||
$str = ( $match[ 1 ] == '-' ? '-' : '' ) . floatval( $match[ 2 ] ) . $match[ 3 ];
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes suffix from 0 unit, ie 0px; => 0;
|
||||
*
|
||||
* @param (string) str: Unit string
|
||||
*/
|
||||
private function units( $str ) {
|
||||
if ( preg_match( $this->runit, $str, $match ) ) {
|
||||
$str = '0';
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes leading zero in decimal, ie 0.33px => .33px
|
||||
*
|
||||
* @param (string) str: Unit string
|
||||
*/
|
||||
private function zeroes( $str ) {
|
||||
if ( preg_match( $this->rzero, $str, $match ) ) {
|
||||
$str = ( isset( $match[ 1 ] ) && $match[ 1 ] == '-' ? '-' : '' ) . $match[ 2 ] . ( isset( $match[ 3 ] ) ? $match[ 3 ] : '' );
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Numeric Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,133 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Option
|
||||
{
|
||||
/**
|
||||
* Option Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (string) custom: Name of the custom mode
|
||||
* @param (array) options: Instance settings
|
||||
*/
|
||||
private $Control;
|
||||
private $custom = '__custom';
|
||||
public $options = array();
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->options = CSSCompression::$defaults;
|
||||
$control->mode = $this->custom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maintainable access to the options array
|
||||
*
|
||||
* - Passing no arguments returns the entire options array
|
||||
* - Passing a single name argument returns the value for the option
|
||||
* - Passing both a name and value, sets the value to the name key, and returns the value
|
||||
* - Passing an array will merge the options with the array passed, for object like extension
|
||||
*
|
||||
* @param (mixed) name: The key name of the option
|
||||
* @param (mixed) value: Value to set the option
|
||||
*/
|
||||
public function option( $name = NULL, $value = NULL ) {
|
||||
if ( $name === NULL ) {
|
||||
return $this->options;
|
||||
}
|
||||
else if ( is_array( $name ) ) {
|
||||
return $this->merge( $name );
|
||||
}
|
||||
else if ( $value === NULL ) {
|
||||
return isset( $this->options[ $name ] ) ? $this->options[ $name ] : NULL;
|
||||
}
|
||||
else {
|
||||
// Readability doesn't signify custom settings
|
||||
if ( $name != 'readability' ) {
|
||||
$this->Control->mode = $this->custom;
|
||||
}
|
||||
|
||||
return ( $this->options[ $name ] = $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset's the default options
|
||||
*
|
||||
* @params none;
|
||||
*/
|
||||
public function reset(){
|
||||
// Reset and return the new options
|
||||
return $this->options = CSSCompression::$defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend like function to merge an array of preferences into
|
||||
* the options array.
|
||||
*
|
||||
* @param (mixed) options: Array of preferences to merge into options
|
||||
*/
|
||||
public function merge( $options = array() ) {
|
||||
$modes = CSSCompression::modes();
|
||||
if ( $options && is_array( $options ) && count( $options ) ) {
|
||||
$this->Control->mode = $this->custom;
|
||||
foreach ( $this->options as $key => $value ) {
|
||||
if ( ! isset( $options[ $key ] ) ) {
|
||||
continue;
|
||||
}
|
||||
else if ( strtolower( $options[ $key ] ) == 'on' ) {
|
||||
$this->options[ $key ] = true;
|
||||
}
|
||||
else if ( strtolower( $options[ $key ] ) == 'off' ) {
|
||||
$this->options[ $key ] = false;
|
||||
}
|
||||
else {
|
||||
$this->options[ $key ] = intval( $options[ $key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( $options && is_string( $options ) && array_key_exists( $options, $modes ) ) {
|
||||
$this->Control->mode = $options;
|
||||
|
||||
// Default all to true, the mode has to force false
|
||||
foreach ( $this->options as $key => $value ) {
|
||||
if ( $key != 'readability' ) {
|
||||
$this->options[ $key ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Merge mode into options
|
||||
foreach ( $modes[ $options ] as $key => $value ) {
|
||||
$this->options[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Option Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,149 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Organize
|
||||
{
|
||||
/**
|
||||
* Organize Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (array) options: Reference to options
|
||||
* @param (regex) rsemicolon: Checks for semicolon without an escape '\' character before it
|
||||
* @param (regex) rlastsemi: Checks for semicolon at the end of the string
|
||||
*/
|
||||
private $Control;
|
||||
private $options = array();
|
||||
private $rsemicolon = "/(?<!\\\);/";
|
||||
private $rlastsemi = "/(?<!\\\);$/";
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->options = &$control->Option->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Look to see if we can combine selectors to reduce the number
|
||||
* of definitions.
|
||||
*
|
||||
* @param (array) selectors: Array of selectors, map directly to details
|
||||
* @param (array) details: Array of rule sets, map directly to selectors
|
||||
*/
|
||||
public function organize( &$selectors = array(), &$details = array() ) {
|
||||
// Combining defns based on similar selectors
|
||||
list ( $selectors, $details ) = $this->reduceSelectors( $selectors, $details );
|
||||
|
||||
// Combining defns based on similar details
|
||||
list ( $selectors, $details ) = $this->reduceDetails( $selectors, $details );
|
||||
|
||||
// Return in package form
|
||||
return array( $selectors, $details );
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines multiply defined selectors by merging the rule sets,
|
||||
* latter declarations overide declaratins at top of file
|
||||
*
|
||||
* @param (array) selectors: Array of selectors broken down by setup
|
||||
* @param (array) details: Array of rule sets broken down by setup
|
||||
*/
|
||||
private function reduceSelectors( $selectors, $details ) {
|
||||
$keys = array_keys( $selectors );
|
||||
$max = array_pop( $keys ) + 1;
|
||||
|
||||
for ( $i = 0; $i < $max; $i++ ) {
|
||||
if ( ! isset( $selectors[ $i ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for ( $k = $i + 1; $k < $max; $k++ ) {
|
||||
if ( ! isset( $selectors[ $k ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $selectors[ $i ] == $selectors[ $k ] ) {
|
||||
// Prevent noticies
|
||||
if ( ! isset( $details[ $i ] ) ) {
|
||||
$details[ $i ] = '';
|
||||
}
|
||||
if ( ! isset( $details[ $k ] ) ) {
|
||||
$details[ $k ] = '';
|
||||
}
|
||||
|
||||
// We kill the last semicolon before organization, so account for that.
|
||||
if ( $details[ $i ] != '' && $details[ $k ] != '' && ! preg_match( $this->rlastsemi, $details[ $i ] ) ) {
|
||||
$details[ $i ] .= ';' . $details[ $k ];
|
||||
}
|
||||
else {
|
||||
$details[ $i ] .= $details[ $k ];
|
||||
}
|
||||
|
||||
// Remove the second part
|
||||
unset( $selectors[ $k ], $details[ $k ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array( $selectors, $details );
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines multiply defined rule sets by merging the selectors
|
||||
* in comma seperated format
|
||||
*
|
||||
* @param (array) selectors: Array of selectors broken down by setup
|
||||
* @param (array) details: Array of rule sets broken down by setup
|
||||
*/
|
||||
private function reduceDetails( $selectors, $details ) {
|
||||
$keys = array_keys( $selectors );
|
||||
$max = array_pop( $keys ) + 1;
|
||||
for ( $i = 0; $i < $max; $i++ ) {
|
||||
if ( ! isset( $selectors[ $i ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$arr = preg_split( $this->rsemicolon, isset( $details[ $i ] ) ? $details[ $i ] : '' );
|
||||
for ( $k = $i + 1; $k < $max; $k++ ) {
|
||||
if ( ! isset( $selectors[ $k ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$match = preg_split( $this->rsemicolon, isset( $details[ $k ] ) ? $details[ $k ] : '' );
|
||||
$x = array_diff( $arr, $match );
|
||||
$y = array_diff( $match, $arr );
|
||||
|
||||
if ( count( $x ) < 1 && count( $y ) < 1 ) {
|
||||
$selectors[ $i ] .= ',' . $selectors[ $k ];
|
||||
unset( $details[ $k ], $selectors[ $k ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array( $selectors, $details );
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Organize Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,245 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Selectors
|
||||
{
|
||||
/**
|
||||
* Selector patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (string) token: Copy of the injection token
|
||||
* @param (regex) ridattr: ID Attribute matcher (combined with token)
|
||||
* @param (regex) rclassattr: class Attribute matcher (combined with token)
|
||||
* @param (array) options: Reference to options
|
||||
* @param (regex) rmark: Stop points during selector parsing
|
||||
* @param (regex) ridclassend: End of a id/class string
|
||||
* @param (regex) rescapedspace: for replacement in class attributes
|
||||
* @param (regex) rquote: Checks for the next quote character
|
||||
* @param (regex) rcomma: looks for an unescaped comma character
|
||||
* @param (regex) rspace: looks for an unescaped space character
|
||||
* @param (regex) rid: looks for an unescaped hash character
|
||||
* @param (regex) rpseudo: Add space after first-letter|line pseudo selector
|
||||
* --- when it occurs before comma or rule set
|
||||
*/
|
||||
private $Control;
|
||||
private $token = '';
|
||||
private $ridattr = "";
|
||||
private $rclassattr = "";
|
||||
private $options = array();
|
||||
private $rmark = "/(?<!\\\)(#|\.|=)/";
|
||||
private $ridclassend = "/(?<!\\\)[:#>~\[\+\*\. ]/";
|
||||
private $rquote = "/(?<!\\\)(\"|')?\]/";
|
||||
private $rescapedspace = "/\\\ /";
|
||||
private $rcomma = "/(?<!\\\),/";
|
||||
private $rspace = "/(?<!\\\)\s/";
|
||||
private $rid = "/(?<!\\\)#/";
|
||||
private $rpseudo = "/:first-(letter|line)(,|$)/i";
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->token = CSSCompression::TOKEN;
|
||||
$this->ridattr = "/\[id=$this->token(.*?)$this->token\]/";
|
||||
$this->rclassattr = "/\[class=$this->token(.*?)$this->token\]/";
|
||||
$this->options = &$control->Option->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selector specific optimizations
|
||||
*
|
||||
* @param (array) selectors: Array of selectors
|
||||
*/
|
||||
public function selectors( &$selectors = array() ) {
|
||||
foreach ( $selectors as &$selector ) {
|
||||
// Auto ignore sections
|
||||
if ( strpos( $selector, $this->token ) === 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Smart casing and token injection
|
||||
$selector = $this->parse( $selector );
|
||||
|
||||
// Converting attr to shorthanded selectors
|
||||
if ( $this->options['attr2selector'] ) {
|
||||
// Use id hash instead of id attr
|
||||
$selector = $this->idAttribute( $selector );
|
||||
|
||||
// Use class notation instead of class attr
|
||||
$selector = $this->classAttribute( $selector );
|
||||
}
|
||||
|
||||
// Remove everything before final id in a selector
|
||||
if ( $this->options['strict-id'] ) {
|
||||
$selector = $this->strictid( $selector );
|
||||
}
|
||||
|
||||
// Get rid of possible repeated selectors
|
||||
$selector = $this->repeats( $selector );
|
||||
|
||||
// Add space after pseudo selectors (so ie6 doesn't complain)
|
||||
if ( $this->options['pseudo-space'] ) {
|
||||
$selector = $this->pseudoSpace( $selector );
|
||||
}
|
||||
}
|
||||
|
||||
return $selectors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts selectors like BODY => body, DIV => div
|
||||
* and injects tokens wrappers for attribute values
|
||||
*
|
||||
* @param (string) selector: CSS Selector
|
||||
*/
|
||||
private function parse( $selector ) {
|
||||
$clean = '';
|
||||
$substr = '';
|
||||
$pos = 0;
|
||||
|
||||
while ( preg_match( $this->rmark, $selector, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$substr = substr( $selector, $pos, $match[ 0 ][ 1 ] + 1 - $pos );
|
||||
$clean .= $this->options['lowercase-selectors'] ? strtolower( $substr ) : $substr;
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 1 ][ 0 ] );
|
||||
|
||||
// Class or id match
|
||||
if ( $match[ 1 ][ 0 ] == '#' || $match[ 1 ][ 0 ] == '.' ) {
|
||||
if ( preg_match( $this->ridclassend, $selector, $m, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$clean .= substr( $selector, $pos, $m[ 0 ][ 1 ] - $pos );
|
||||
$pos = $m[ 0 ][ 1 ];
|
||||
}
|
||||
else {
|
||||
$clean .= substr( $selector, $pos );
|
||||
$pos = strlen( $selector );
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Start of a string
|
||||
else if ( preg_match( $this->rquote, $selector, $m, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
if ( $selector[ $pos ] == "\"" || $selector[ $pos ] == "'" ) {
|
||||
$pos++;
|
||||
}
|
||||
$clean .= $this->token . substr( $selector, $pos, $m[ 0 ][ 1 ] - $pos ) . $this->token . ']';
|
||||
$pos = $m[ 0 ][ 1 ] + strlen( $m[ 0 ][ 0 ] );
|
||||
}
|
||||
// No break points left
|
||||
else {
|
||||
$clean .= substr( $selector, $pos );
|
||||
$pos = strlen( $selector );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $clean . ( $this->options['lowercase-selectors'] ? strtolower( substr( $selector, $pos ) ) : substr( $selector, $pos ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert [id=blah] attribute selectors into id form selector (#blah)
|
||||
*
|
||||
* @param (string) selector: CSS Selector
|
||||
*/
|
||||
private function idAttribute( $selector ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->ridattr, $selector, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
// Don't convert if space found (not valid hash selector)
|
||||
if ( strpos( $match[ 1 ][ 0 ], ' ' ) !== false ) {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] );
|
||||
continue;
|
||||
}
|
||||
|
||||
$selector = substr_replace( $selector, '#' . $match[ 1 ][ 0 ], $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 1 ][ 0 ] ) + 1;
|
||||
}
|
||||
|
||||
return $selector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert [class=blah] attribute selectors into class form selector (.blah)
|
||||
*
|
||||
* @param (string) selector: CSS Selector
|
||||
*/
|
||||
private function classAttribute( $selector ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rclassattr, $selector, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
// Don't convert if prescense of dot separator found
|
||||
if ( strpos( $match[ 1 ][ 0 ], '.' ) !== false ) {
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] );
|
||||
continue;
|
||||
}
|
||||
|
||||
$replace = '.' . preg_replace( $this->rescapedspace, ".", $match[ 1 ][ 0 ] );
|
||||
$selector = substr_replace( $selector, $replace, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 1 ][ 0 ] ) + 1;
|
||||
}
|
||||
|
||||
return $selector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Promotes nested id's to the front of the selector
|
||||
*
|
||||
* @param (string) selector: CSS Selector
|
||||
*/
|
||||
private function strictid( $selector ) {
|
||||
$parts = preg_split( $this->rcomma, $selector );
|
||||
foreach ( $parts as &$s ) {
|
||||
if ( preg_match( $this->rid, $s ) ) {
|
||||
$p = preg_split( $this->rid, $s );
|
||||
$s = '#' . array_pop( $p );
|
||||
}
|
||||
}
|
||||
|
||||
return implode( ',', $parts );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes repeated selectors that have been comma separated
|
||||
*
|
||||
* @param (string) selector: CSS Selector
|
||||
*/
|
||||
private function repeats( $selector ) {
|
||||
$parts = preg_split( $this->rcomma, $selector );
|
||||
$parts = array_flip( $parts );
|
||||
$parts = array_flip( $parts );
|
||||
return implode( ',', $parts );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds space after pseudo selector for ie6 like a:first-child{ => a:first-child {
|
||||
*
|
||||
* @param (string) selector: CSS Selector
|
||||
*/
|
||||
private function pseudoSpace( $selector ) {
|
||||
return preg_replace( $this->rpseudo, ":first-$1 $2", $selector );
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
if ( $method == 'selectors' ) {
|
||||
return $this->selectors( $args[ 0 ] );
|
||||
}
|
||||
else {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Selectors Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,292 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Setup
|
||||
{
|
||||
/**
|
||||
* Trim Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @class Individuals: Individuals Instance
|
||||
* @instance instance: CSSCompression Instance
|
||||
* @param (string) token: Copy of the injection token
|
||||
* @param (array) options: Reference to options
|
||||
* @param (array) stats: Reference to stats
|
||||
* @param (regex) rsemicolon: Checks for semicolon without an escape '\' character before it
|
||||
* @param (regex) rcolon: Checks for colon without an escape '\' character before it
|
||||
* @param (regex) rbang: Checks for '!' without an escape '\' character before it
|
||||
* @param (regex) rspacebank: Checks for an unescaped space before a bang character
|
||||
* @param (regex) rliner: Matching known 1-line intros
|
||||
* @param (regex) rnested: Matching known subsection handlers
|
||||
* @param (regex) rurl: url wrapper matching
|
||||
* @param (regex) rsinglequote: Checks for unescaped escaped single quote (mouthfull)
|
||||
* @param (array) rsetup: Expanding stylesheet for semi-tokenizing
|
||||
*/
|
||||
private $Control;
|
||||
private $Individuals;
|
||||
private $instance;
|
||||
private $token = '';
|
||||
private $options = array();
|
||||
private $stats = array();
|
||||
private $rsemicolon = "/(?<!\\\);/";
|
||||
private $rcolon = "/(?<!\\\):/";
|
||||
private $rbang = "/(?<!\\\)\!/";
|
||||
private $rspacebang = "/(?<!\\\)\s\!/";
|
||||
private $rliner = "/^@(import|charset|namespace)/i";
|
||||
private $rmedia = "/^@media/i";
|
||||
private $rurl = "/url\((.*?)\)/";
|
||||
private $rsinglequote = "/(?<!\\\)\\\'/";
|
||||
private $rsetup = array(
|
||||
'patterns' => array(
|
||||
"/(?<!\\\){/",
|
||||
"/(?<!\\\)}/",
|
||||
"/(?<!\\\)@/",
|
||||
"/(@(charset|import)[^;]*(?<!\\\);)/",
|
||||
),
|
||||
'replacements' => array(
|
||||
"\n{\n",
|
||||
"\n}\n",
|
||||
"\n@",
|
||||
"$1\n",
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->Individuals = $control->Individuals;
|
||||
$this->token = CSSCompression::TOKEN;
|
||||
$this->options = &$control->Option->options;
|
||||
$this->stats = &$control->stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup selector and details arrays for compression methods
|
||||
*
|
||||
* @param (string) css: Trimed stylesheet
|
||||
*/
|
||||
public function setup( $css ) {
|
||||
// Seperate the element from the elements details
|
||||
$css = explode( "\n", preg_replace( $this->rsetup['patterns'], $this->rsetup['replacements'], $css ) );
|
||||
$newline = $this->options['readability'] > CSSCompression::READ_NONE ? "\n" : '';
|
||||
$setup = array(
|
||||
'selectors' => array(),
|
||||
'details' => array(),
|
||||
'unknown' => array(),
|
||||
'introliner' => '',
|
||||
'namespace' => '',
|
||||
'import' => '',
|
||||
'charset' => '',
|
||||
);
|
||||
|
||||
while ( count( $css ) ) {
|
||||
$row = trim( array_shift( $css ) );
|
||||
|
||||
if ( $row == '' ) {
|
||||
continue;
|
||||
}
|
||||
// Single block At-Rule set
|
||||
else if ( $row[ 0 ] == '@' && $css[ 0 ] == '{' && trim( $css[ 1 ] ) != '' && $css[ 2 ] == '}' ) {
|
||||
// Stash selector
|
||||
array_push( $setup['selectors'], $row );
|
||||
|
||||
// Stash details (after the opening brace)
|
||||
array_push( $setup['details'], $this->details( trim( $css[ 1 ] ) ) );
|
||||
|
||||
// drop the details from the stack
|
||||
$css = array_slice( $css, 3 );
|
||||
}
|
||||
// Single line At-Rules (import/charset/namespace)
|
||||
else if ( preg_match( $this->rliner, $row, $match ) ) {
|
||||
$setup[ $match[ 1 ] ] .= $this->liner( $row ) . $newline;
|
||||
}
|
||||
// Nested At-Rule declaration blocks
|
||||
else if ( $row[ 0 ] == '@' && $css[ 0 ] == '{' ) {
|
||||
// Stash atrule as selector
|
||||
array_push( $setup['selectors'], $this->token . $row );
|
||||
|
||||
// Stash details (after the opening brace)
|
||||
array_push( $setup['details'], $this->nested( $css, preg_match( $this->rmedia, $row ) ) . $newline );
|
||||
}
|
||||
// Unknown single line At-Rules
|
||||
else if ( $row[ 0 ] == '@' && substr( $row, -1 ) == ';' ) {
|
||||
$setup[ 'introliner' ] .= $row . $newline;
|
||||
}
|
||||
// Declaration Block
|
||||
else if ( count( $css ) >= 3 && $css[ 0 ] == '{' && $css[ 2 ] == '}' ) {
|
||||
// Stash selector
|
||||
array_push( $setup['selectors'], $row );
|
||||
|
||||
// Stash details (after the opening brace)
|
||||
array_push( $setup['details'], $this->details( trim( $css[ 1 ] ) ) );
|
||||
|
||||
// drop the details from the stack
|
||||
$css = array_slice( $css, 3 );
|
||||
}
|
||||
// Last catch, store unknown artifacts as selectors with a token
|
||||
// and give it an empty rule set
|
||||
else {
|
||||
// Still add to unknown stack, for notification
|
||||
array_push( $setup['unknown'], $row );
|
||||
|
||||
// Stash unknown artifacts as selectors with a token
|
||||
array_push( $setup['selectors'], $this->token . $row );
|
||||
|
||||
// Give it an empty rule set
|
||||
array_push( $setup['details'], '' );
|
||||
}
|
||||
}
|
||||
|
||||
return $setup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run nested elements through a separate instance of compression
|
||||
*
|
||||
* @param (array) css: Reference to the original css array
|
||||
* @param (bool) organize: Whether or not to organize the subsection (only true for media sections)
|
||||
*/
|
||||
private function nested( &$css = array(), $organize = false ) {
|
||||
$options = $this->options;
|
||||
$left = 0;
|
||||
$right = 0;
|
||||
$row = '';
|
||||
$independent = '';
|
||||
$content = '';
|
||||
$spacing = '';
|
||||
$newline = $this->options['readability'] > CSSCompression::READ_NONE ? "\n" : '';
|
||||
|
||||
// Find the end of the nested section
|
||||
while ( count( $css ) && ( $left < 1 || $left > $right ) ) {
|
||||
$row = trim( array_shift( $css ) );
|
||||
|
||||
if ( $row == '' ) {
|
||||
continue;
|
||||
}
|
||||
else if ( $row == '{' ) {
|
||||
$left++;
|
||||
}
|
||||
else if ( $row == '}' ) {
|
||||
$right++;
|
||||
}
|
||||
else if ( count( $css ) && substr( $row, 0, 1 ) != '@' && substr( $css[ 0 ], 0, 1 ) == '@' && substr( $row, -1 ) == ';' ) {
|
||||
$independent .= $row;
|
||||
continue;
|
||||
}
|
||||
|
||||
$content .= $row;
|
||||
}
|
||||
|
||||
// Ensure copy of instance exists
|
||||
if ( ! $this->instance ) {
|
||||
$this->instance = new CSSCompression();
|
||||
}
|
||||
|
||||
// Fresh start
|
||||
$this->instance->reset();
|
||||
|
||||
// Compress the nested section independently after removing the wrapping braces
|
||||
// Also make sure to only organize media sections
|
||||
if ( $options['organize'] == true && $organize == false ) {
|
||||
$options['organize'] = false;
|
||||
}
|
||||
// Independent sections should be prepended to the next compressed section
|
||||
$content = ( $independent == '' ? '' : $independent . $newline )
|
||||
. $this->instance->compress( substr( $content, 1, -1 ), $options );
|
||||
|
||||
// Formatting for anything higher then 0 readability
|
||||
if ( $newline == "\n" ) {
|
||||
$content = "\n\t" . str_replace( "\n", "\n\t", $content ) . "\n";
|
||||
$spacing = $this->options['readability'] > CSSCompression::READ_MIN ? ' ' : '';
|
||||
}
|
||||
|
||||
// Stash the compressed nested script
|
||||
return "$spacing{" . $content . "}$newline";
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts import/namespace urls into strings
|
||||
*
|
||||
* @param (string) row: At-rule
|
||||
*/
|
||||
private function liner( $row ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rurl, $row, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
$quote = preg_match( $this->rsinglequote, $match[ 1 ][ 0 ] ) ? '"' : "'";
|
||||
$replace = $quote . $match[ 1 ][ 0 ] . $quote;
|
||||
$row = substr_replace( $row, $replace, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
||||
$pos = $match[ 0 ][ 1 ] + strlen( $replace );
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run individual compression techniques on each property of a selector
|
||||
*
|
||||
* @param (string) row: Selector properties
|
||||
*/
|
||||
private function details( $row ) {
|
||||
$row = preg_split( $this->rsemicolon, $row );
|
||||
$parts = array();
|
||||
$details = '';
|
||||
|
||||
foreach ( $row as $line ) {
|
||||
// Set loopers
|
||||
$parts = preg_split( $this->rcolon, $line, 2 );
|
||||
$prop = '';
|
||||
$value = '';
|
||||
|
||||
// Property
|
||||
if ( isset( $parts[ 0 ] ) && ( $parts[ 0 ] = trim( $parts[ 0 ] ) ) != '' ) {
|
||||
$prop = $parts[ 0 ];
|
||||
}
|
||||
|
||||
// Value
|
||||
if ( isset( $parts[ 1 ] ) && ( $parts[ 1 ] = trim( $parts[ 1 ] ) ) != '' ) {
|
||||
$value = preg_replace( $this->rbang, ' !', $parts[ 1 ] );
|
||||
}
|
||||
|
||||
// Fail safe, remove unspecified property/values
|
||||
if ( $prop == '' || $value == '' ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Run the tag/element through each compression
|
||||
list ( $prop, $value ) = $this->Individuals->individuals( $prop, $value );
|
||||
|
||||
// Add counter to before stats
|
||||
$this->stats['before']['props']++;
|
||||
|
||||
// Store the compressed element
|
||||
$details .= "$prop:" . preg_replace( $this->rspacebang, '!', $value ) . ";";
|
||||
}
|
||||
|
||||
return $details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Setup Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,213 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CSS Compressor [VERSION]
|
||||
* [DATE]
|
||||
* Corey Hart @ http://www.codenothing.com
|
||||
*/
|
||||
|
||||
Class CSSCompression_Trim
|
||||
{
|
||||
/**
|
||||
* Trim Patterns
|
||||
*
|
||||
* @class Control: Compression Controller
|
||||
* @param (array) options: Reference to options
|
||||
* @param (regex) rcmark: Marking point when traversing through sheet for comments
|
||||
* @param (regex) rendcomment: Finds the ending comment point
|
||||
* @param (regex) rendquote: Finds the ending quote point
|
||||
* @param (regex) rendsinglequote: Finds the ending single quote point
|
||||
* @param (array) rescape: Array of patterns of groupings that should be escaped
|
||||
* @param (array) trimmings: Stylesheet trimming patterns/replacements
|
||||
* @param (array) escaped: Array of characters that need to be escaped
|
||||
*/
|
||||
private $Control;
|
||||
private $options = array();
|
||||
private $rcmark = "/((?<!\\\)\/\*|(?<!\\\)\"|(?<!\\\)')/";
|
||||
private $rendcomment = "/\*\//";
|
||||
private $rendquote = "/(?<!\\\)\"/";
|
||||
private $rendsinglequote = "/(?<!\\\)'/";
|
||||
private $rescape = array(
|
||||
"/(url\()([^'\"].*?)(\))/is",
|
||||
"/((?<!\\\)\")(.*?)((?<!\\\)\")/s",
|
||||
"/((?<!\\\)')(.*?)((?<!\\\)')/s",
|
||||
);
|
||||
private $trimmings = array(
|
||||
'patterns' => array(
|
||||
"/(?<!\\\)(\s+)?(?<!\\\)([!,{};>\~\+\/])(?<!\\\)(\s+)?/s", // Remove un-needed spaces around special characters
|
||||
"/url\((?<!\\\)\"(.*?)(?<!\\\)\"\)/is", // Remove quotes from urls
|
||||
"/url\((?<!\\\)'(.*?)(?<!\\\)'\)/is", // Remove single quotes from urls
|
||||
"/url\((.*?)\)/is", // Lowercase url wrapper
|
||||
"/(?<!\\\);{2,}/", // Remove unecessary semi-colons
|
||||
"/(?<!\\\)\s+/s", // Compress all spaces into single space
|
||||
),
|
||||
'replacements' => array(
|
||||
'$2',
|
||||
'url($1)',
|
||||
'url($1)',
|
||||
'url($1)',
|
||||
';',
|
||||
' ',
|
||||
)
|
||||
);
|
||||
private $escaped = array(
|
||||
'search' => array(
|
||||
":",
|
||||
";",
|
||||
"}",
|
||||
"{",
|
||||
"@",
|
||||
"!",
|
||||
",",
|
||||
">",
|
||||
"+",
|
||||
"~",
|
||||
"/",
|
||||
"*",
|
||||
".",
|
||||
"=",
|
||||
"#",
|
||||
"\r",
|
||||
"\n",
|
||||
"\t",
|
||||
" ",
|
||||
),
|
||||
'replace' => array(
|
||||
"\\:",
|
||||
"\\;",
|
||||
"\\}",
|
||||
"\\{",
|
||||
"\\@",
|
||||
"\\!",
|
||||
"\\,",
|
||||
"\\>",
|
||||
"\\+",
|
||||
"\\~",
|
||||
"\\/",
|
||||
"\\*",
|
||||
"\\.",
|
||||
"\\=",
|
||||
"\\#",
|
||||
"\\r",
|
||||
"\\n",
|
||||
"\\t",
|
||||
"\\ ",
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Stash a reference to the controller on each instantiation
|
||||
*
|
||||
* @param (class) control: CSSCompression Controller
|
||||
*/
|
||||
public function __construct( CSSCompression_Control $control ) {
|
||||
$this->Control = $control;
|
||||
$this->options = &$control->Option->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Central trim handler
|
||||
*
|
||||
* @param (string) css: Stylesheet to trim
|
||||
*/
|
||||
public function trim( $css ) {
|
||||
$css = $this->comments( $css );
|
||||
$css = $this->escape( $css );
|
||||
$css = $this->strip( $css );
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a quick run through the script to remove all comments from the sheet,
|
||||
*
|
||||
* @param (string) css: Stylesheet to trim
|
||||
*/
|
||||
private function comments( $css ) {
|
||||
$pos = 0;
|
||||
while ( preg_match( $this->rcmark, $css, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
||||
switch ( $match[ 1 ][ 0 ] ) {
|
||||
// Start of comment block
|
||||
case "/*":
|
||||
if ( preg_match( $this->rendcomment, $css, $m, PREG_OFFSET_CAPTURE, $match[ 1 ][ 1 ] + 1 ) ) {
|
||||
$end = $m[ 0 ][ 1 ] - $match[ 1 ][ 1 ] + strlen( $m[ 0 ][ 0 ] );
|
||||
$css = substr_replace( $css, '', $match[ 1 ][ 1 ], $end );
|
||||
$pos = $match[ 0 ][ 1 ];
|
||||
}
|
||||
else {
|
||||
$css = substr( $css, 0, $match[ 1 ][ 1 ] );
|
||||
break 2;
|
||||
}
|
||||
break;
|
||||
// Start of string
|
||||
case "\"":
|
||||
if ( preg_match( $this->rendquote, $css, $m, PREG_OFFSET_CAPTURE, $match[ 1 ][ 1 ] + 1 ) ) {
|
||||
$pos = $m[ 0 ][ 1 ] + strlen( $m[ 0 ][ 0 ] );
|
||||
}
|
||||
else {
|
||||
break 2;
|
||||
}
|
||||
break;
|
||||
// Start of string
|
||||
case "'":
|
||||
if ( preg_match( $this->rendsinglequote, $css, $m, PREG_OFFSET_CAPTURE, $match[ 1 ][ 1 ] + 1 ) ) {
|
||||
$pos = $m[ 0 ][ 1 ] + strlen( $m[ 0 ][ 0 ] );
|
||||
}
|
||||
else {
|
||||
break 2;
|
||||
}
|
||||
break;
|
||||
// Should have never gotten here
|
||||
default:
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape out possible splitter characters within urls
|
||||
*
|
||||
* @param (string) css: Full stylesheet
|
||||
*/
|
||||
private function escape( $css ) {
|
||||
foreach ( $this->rescape as $regex ) {
|
||||
$start = 0;
|
||||
while ( preg_match( $regex, $css, $match, PREG_OFFSET_CAPTURE, $start ) ) {
|
||||
$value = $match[ 1 ][ 0 ]
|
||||
. str_replace( $this->escaped['search'], $this->escaped['replace'], $match[ 2 ][ 0 ] )
|
||||
. $match[ 3 ][ 0 ];
|
||||
$css = substr_replace( $css, $value, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
||||
$start = $match[ 0 ][ 1 ] + strlen( $value ) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs initial formatting to setup for compression
|
||||
*
|
||||
* @param (string) css: CSS Contents
|
||||
*/
|
||||
private function strip( $css ) {
|
||||
// Run replacements
|
||||
return trim( preg_replace( $this->trimmings['patterns'], $this->trimmings['replacements'], $css ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to private methods for testing
|
||||
*
|
||||
* @param (string) method: Method to be called
|
||||
* @param (array) args: Array of paramters to be passed in
|
||||
*/
|
||||
public function access( $method, $args ) {
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
return call_user_func_array( array( $this, $method ), $args );
|
||||
}
|
||||
else {
|
||||
throw new CSSCompression_Exception( "Unknown method in Trim Class - " . $method );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
Copyright (C) 2001-2010 Cosmin Truta.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the author(s) be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
|
||||
<cross-domain-policy>
|
||||
|
||||
|
||||
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
|
||||
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
|
||||
|
||||
<!-- Most restrictive policy: -->
|
||||
<site-control permitted-cross-domain-policies="none"/>
|
||||
|
||||
|
||||
|
||||
<!-- Least restrictive policy: -->
|
||||
<!--
|
||||
<site-control permitted-cross-domain-policies="all"/>
|
||||
<allow-access-from domain="*" to-ports="*" secure="false"/>
|
||||
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
|
||||
-->
|
||||
<!--
|
||||
If you host a crossdomain.xml file with allow-access-from domain=“*”
|
||||
and don’t understand all of the points described here, you probably
|
||||
have a nasty security vulnerability. ~ simon willison
|
||||
-->
|
||||
<!-- Most restrictive policy: -->
|
||||
<site-control permitted-cross-domain-policies="none"/>
|
||||
|
||||
</cross-domain-policy>
|
||||
<!-- Least restrictive policy: -->
|
||||
<!--
|
||||
<site-control permitted-cross-domain-policies="all"/>
|
||||
<allow-access-from domain="*" to-ports="*" secure="false"/>
|
||||
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
|
||||
-->
|
||||
</cross-domain-policy>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
* {
|
||||
float: none; /* Screens are not big enough to account for floats */
|
||||
background: #fff; /* As much contrast as possible */
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/* Slightly reducing font size to reduce need to scroll */
|
||||
body { font-size: 80%; }
|
||||
298
css/main.css
Normal file
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
* HTML5 Boilerplate
|
||||
*
|
||||
* What follows is the result of much research on cross-browser styling.
|
||||
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
|
||||
* Kroc Camen, and the H5BP dev community and team.
|
||||
*/
|
||||
|
||||
/* ==========================================================================
|
||||
Base styles: opinionated defaults
|
||||
========================================================================== */
|
||||
|
||||
html,
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
color: #222;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 1em;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove text-shadow in selection highlight: h5bp.com/i
|
||||
* These selection declarations have to be separate.
|
||||
* Customize the background color to match your design.
|
||||
*/
|
||||
|
||||
::-moz-selection {
|
||||
background: #b3d4fc;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
::selection {
|
||||
background: #b3d4fc;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
/*
|
||||
* A better looking default horizontal rule
|
||||
*/
|
||||
|
||||
hr {
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
border-top: 1px solid #ccc;
|
||||
margin: 1em 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the gap between images and the bottom of their containers: h5bp.com/i/440
|
||||
*/
|
||||
|
||||
img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove default fieldset styles.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow only vertical resizing of textareas.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Chrome Frame prompt
|
||||
========================================================================== */
|
||||
|
||||
.chromeframe {
|
||||
margin: 0.2em 0;
|
||||
background: #ccc;
|
||||
color: #000;
|
||||
padding: 0.2em 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Author's custom styles
|
||||
========================================================================== */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ==========================================================================
|
||||
Helper classes
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Image replacement
|
||||
*/
|
||||
|
||||
.ir {
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
overflow: hidden;
|
||||
/* IE 6/7 fallback */
|
||||
*text-indent: -9999px;
|
||||
}
|
||||
|
||||
.ir:before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/*
|
||||
* Hide from both screenreaders and browsers: h5bp.com/u
|
||||
*/
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
* Hide only visually, but have it available for screenreaders: h5bp.com/v
|
||||
*/
|
||||
|
||||
.visuallyhidden {
|
||||
border: 0;
|
||||
clip: rect(0 0 0 0);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extends the .visuallyhidden class to allow the element to be focusable
|
||||
* when navigated to via the keyboard: h5bp.com/p
|
||||
*/
|
||||
|
||||
.visuallyhidden.focusable:active,
|
||||
.visuallyhidden.focusable:focus {
|
||||
clip: auto;
|
||||
height: auto;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
position: static;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
* Hide visually and from screenreaders, but maintain layout
|
||||
*/
|
||||
|
||||
.invisible {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clearfix: contain floats
|
||||
*
|
||||
* For modern browsers
|
||||
* 1. The space content is one way to avoid an Opera bug when the
|
||||
* `contenteditable` attribute is included anywhere else in the document.
|
||||
* Otherwise it causes space to appear at the top and bottom of elements
|
||||
* that receive the `clearfix` class.
|
||||
* 2. The use of `table` rather than `block` is only necessary if using
|
||||
* `:before` to contain the top-margins of child elements.
|
||||
*/
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
content: " "; /* 1 */
|
||||
display: table; /* 2 */
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/*
|
||||
* For IE 6/7 only
|
||||
* Include this rule to trigger hasLayout and contain floats.
|
||||
*/
|
||||
|
||||
.clearfix {
|
||||
*zoom: 1;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
EXAMPLE Media Queries for Responsive Design.
|
||||
Theses examples override the primary ('mobile first') styles.
|
||||
Modify as content requires.
|
||||
========================================================================== */
|
||||
|
||||
@media only screen and (min-width: 35em) {
|
||||
/* Style adjustments for viewports that meet the condition */
|
||||
}
|
||||
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
||||
only screen and (min-resolution: 144dpi) {
|
||||
/* Style adjustments for high resolution devices */
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Print styles.
|
||||
Inlined to avoid required HTTP connection: h5bp.com/r
|
||||
========================================================================== */
|
||||
|
||||
@media print {
|
||||
* {
|
||||
background: transparent !important;
|
||||
color: #000 !important; /* Black prints faster: h5bp.com/s */
|
||||
box-shadow:none !important;
|
||||
text-shadow: none !important;
|
||||
}
|
||||
|
||||
a,
|
||||
a:visited {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a[href]:after {
|
||||
content: " (" attr(href) ")";
|
||||
}
|
||||
|
||||
abbr[title]:after {
|
||||
content: " (" attr(title) ")";
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't show links for images, or javascript/internal links
|
||||
*/
|
||||
|
||||
.ir a:after,
|
||||
a[href^="javascript:"]:after,
|
||||
a[href^="#"]:after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
pre,
|
||||
blockquote {
|
||||
border: 1px solid #999;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
thead {
|
||||
display: table-header-group; /* h5bp.com/t */
|
||||
}
|
||||
|
||||
tr,
|
||||
img {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
@page {
|
||||
margin: 0.5cm;
|
||||
}
|
||||
|
||||
p,
|
||||
h2,
|
||||
h3 {
|
||||
orphans: 3;
|
||||
widows: 3;
|
||||
}
|
||||
|
||||
h2,
|
||||
h3 {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
}
|
||||
504
css/normalize.css
vendored
Normal file
@@ -0,0 +1,504 @@
|
||||
/*! normalize.css v1.0.1 | MIT License | git.io/normalize */
|
||||
|
||||
/* ==========================================================================
|
||||
HTML5 display definitions
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Corrects `block` display not defined in IE 6/7/8/9 and Firefox 3.
|
||||
*/
|
||||
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
nav,
|
||||
section,
|
||||
summary {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Corrects `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
|
||||
*/
|
||||
|
||||
audio,
|
||||
canvas,
|
||||
video {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevents modern browsers from displaying `audio` without controls.
|
||||
* Remove excess height in iOS 5 devices.
|
||||
*/
|
||||
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses styling for `hidden` attribute not present in IE 7/8/9, Firefox 3,
|
||||
* and Safari 4.
|
||||
* Known issue: no IE 6 support.
|
||||
*/
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Base
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* 1. Corrects text resizing oddly in IE 6/7 when body `font-size` is set using
|
||||
* `em` units.
|
||||
* 2. Prevents iOS text size adjust after orientation change, without disabling
|
||||
* user zoom.
|
||||
*/
|
||||
|
||||
html {
|
||||
font-size: 100%; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
-ms-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses `font-family` inconsistency between `textarea` and other form
|
||||
* elements.
|
||||
*/
|
||||
|
||||
html,
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses margins handled incorrectly in IE 6/7.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Links
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Addresses `outline` inconsistency between Chrome and other browsers.
|
||||
*/
|
||||
|
||||
a:focus {
|
||||
outline: thin dotted;
|
||||
}
|
||||
|
||||
/*
|
||||
* Improves readability when focused and also mouse hovered in all browsers.
|
||||
*/
|
||||
|
||||
a:active,
|
||||
a:hover {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Typography
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Addresses font sizes and margins set differently in IE 6/7.
|
||||
* Addresses font sizes within `section` and `article` in Firefox 4+, Safari 5,
|
||||
* and Chrome.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
margin: 0.83em 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.17em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 1em;
|
||||
margin: 1.33em 0;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 0.83em;
|
||||
margin: 1.67em 0;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 0.75em;
|
||||
margin: 2.33em 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses styling not present in IE 7/8/9, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: 1px dotted;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 1em 40px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses styling not present in Safari 5 and Chrome.
|
||||
*/
|
||||
|
||||
dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses styling not present in IE 6/7/8/9.
|
||||
*/
|
||||
|
||||
mark {
|
||||
background: #ff0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses margins set differently in IE 6/7.
|
||||
*/
|
||||
|
||||
p,
|
||||
pre {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Corrects font family set oddly in IE 6, Safari 4/5, and Chrome.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, serif;
|
||||
_font-family: 'courier new', monospace;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/*
|
||||
* Improves readability of pre-formatted text in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
white-space: pre;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses CSS quotes not supported in IE 6/7.
|
||||
*/
|
||||
|
||||
q {
|
||||
quotes: none;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses `quotes` property not supported in Safari 4.
|
||||
*/
|
||||
|
||||
q:before,
|
||||
q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses inconsistent and variable font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevents `sub` and `sup` affecting `line-height` in all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Lists
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Addresses margins set differently in IE 6/7.
|
||||
*/
|
||||
|
||||
dl,
|
||||
menu,
|
||||
ol,
|
||||
ul {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0 0 0 40px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses paddings set differently in IE 6/7.
|
||||
*/
|
||||
|
||||
menu,
|
||||
ol,
|
||||
ul {
|
||||
padding: 0 0 0 40px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Corrects list images handled incorrectly in IE 7.
|
||||
*/
|
||||
|
||||
nav ul,
|
||||
nav ol {
|
||||
list-style: none;
|
||||
list-style-image: none;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* 1. Removes border when inside `a` element in IE 6/7/8/9 and Firefox 3.
|
||||
* 2. Improves image quality when scaled in IE 7.
|
||||
*/
|
||||
|
||||
img {
|
||||
border: 0; /* 1 */
|
||||
-ms-interpolation-mode: bicubic; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
* Corrects overflow displayed oddly in IE 9.
|
||||
*/
|
||||
|
||||
svg:not(:root) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Figures
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Addresses margin not present in IE 6/7/8/9, Safari 5, and Opera 11.
|
||||
*/
|
||||
|
||||
figure {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Forms
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Corrects margin displayed oddly in IE 6/7.
|
||||
*/
|
||||
|
||||
form {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Define consistent border, margin, and padding.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. Corrects color not being inherited in IE 6/7/8/9.
|
||||
* 2. Corrects text not wrapping in Firefox 3.
|
||||
* 3. Corrects alignment displayed oddly in IE 6/7.
|
||||
*/
|
||||
|
||||
legend {
|
||||
border: 0; /* 1 */
|
||||
padding: 0;
|
||||
white-space: normal; /* 2 */
|
||||
*margin-left: -7px; /* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. Corrects font size not being inherited in all browsers.
|
||||
* 2. Addresses margins set differently in IE 6/7, Firefox 3+, Safari 5,
|
||||
* and Chrome.
|
||||
* 3. Improves appearance and consistency in all browsers.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
font-size: 100%; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
vertical-align: baseline; /* 3 */
|
||||
*vertical-align: middle; /* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
* Addresses Firefox 3+ setting `line-height` on `input` using `!important` in
|
||||
* the UA stylesheet.
|
||||
*/
|
||||
|
||||
button,
|
||||
input {
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
|
||||
* and `video` controls.
|
||||
* 2. Corrects inability to style clickable `input` types in iOS.
|
||||
* 3. Improves usability and consistency of cursor style between image-type
|
||||
* `input` and others.
|
||||
* 4. Removes inner spacing in IE 7 without affecting normal text inputs.
|
||||
* Known issue: inner spacing remains in IE 6.
|
||||
*/
|
||||
|
||||
button,
|
||||
html input[type="button"], /* 1 */
|
||||
input[type="reset"],
|
||||
input[type="submit"] {
|
||||
-webkit-appearance: button; /* 2 */
|
||||
cursor: pointer; /* 3 */
|
||||
*overflow: visible; /* 4 */
|
||||
}
|
||||
|
||||
/*
|
||||
* Re-set default cursor for disabled elements.
|
||||
*/
|
||||
|
||||
button[disabled],
|
||||
input[disabled] {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. Addresses box sizing set to content-box in IE 8/9.
|
||||
* 2. Removes excess padding in IE 8/9.
|
||||
* 3. Removes excess padding in IE 7.
|
||||
* Known issue: excess padding remains in IE 6.
|
||||
*/
|
||||
|
||||
input[type="checkbox"],
|
||||
input[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
*height: 13px; /* 3 */
|
||||
*width: 13px; /* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
|
||||
* 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
|
||||
* (include `-moz` to future-proof).
|
||||
*/
|
||||
|
||||
input[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
-moz-box-sizing: content-box;
|
||||
-webkit-box-sizing: content-box; /* 2 */
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes inner padding and search cancel button in Safari 5 and Chrome
|
||||
* on OS X.
|
||||
*/
|
||||
|
||||
input[type="search"]::-webkit-search-cancel-button,
|
||||
input[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes inner padding and border in Firefox 3+.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. Removes default vertical scrollbar in IE 6/7/8/9.
|
||||
* 2. Improves readability and alignment in all browsers.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto; /* 1 */
|
||||
vertical-align: top; /* 2 */
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Tables
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Remove most spacing between table cells.
|
||||
*/
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
261
css/style.css
@@ -1,261 +0,0 @@
|
||||
/**
|
||||
* HTML5 ✰ Boilerplate
|
||||
*
|
||||
* style.css contains a reset, font normalization and some base styles.
|
||||
*
|
||||
* Credit is left where credit is due.
|
||||
* Much inspiration was taken from these projects:
|
||||
* - yui.yahooapis.com/2.8.1/build/base/base.css
|
||||
* - camendesign.com/design/
|
||||
* - praegnanz.de/weblog/htmlcssjs-kickstart
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
|
||||
* v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark
|
||||
* html5doctor.com/html-5-reset-stylesheet/
|
||||
*/
|
||||
|
||||
html, body, div, span, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
|
||||
small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
|
||||
blockquote, q { quotes: none; }
|
||||
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after { content: ''; content: none; }
|
||||
|
||||
ins { background-color: #ff9; color: #000; text-decoration: none; }
|
||||
|
||||
mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
|
||||
|
||||
del { text-decoration: line-through; }
|
||||
|
||||
abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
|
||||
|
||||
table { border-collapse: collapse; border-spacing: 0; }
|
||||
|
||||
hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
|
||||
|
||||
input, select { vertical-align: middle; }
|
||||
|
||||
|
||||
/**
|
||||
* Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui/
|
||||
*/
|
||||
|
||||
body { font:13px/1.231 sans-serif; *font-size:small; } /* Hack retained to preserve specificity */
|
||||
select, input, textarea, button { font:99% sans-serif; }
|
||||
|
||||
/* Normalize monospace sizing:
|
||||
en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */
|
||||
pre, code, kbd, samp { font-family: monospace, sans-serif; }
|
||||
|
||||
|
||||
/**
|
||||
* Minimal base styles.
|
||||
*/
|
||||
|
||||
/* Always force a scrollbar in non-IE */
|
||||
html { overflow-y: scroll; }
|
||||
|
||||
/* Accessible focus treatment: people.opera.com/patrickl/experiments/keyboard/test */
|
||||
a:hover, a:active { outline: none; }
|
||||
|
||||
ul, ol { margin-left: 2em; }
|
||||
ol { list-style-type: decimal; }
|
||||
|
||||
/* Remove margins for navigation lists */
|
||||
nav ul, nav li { margin: 0; list-style:none; list-style-image: none; }
|
||||
|
||||
small { font-size: 85%; }
|
||||
strong, th { font-weight: bold; }
|
||||
|
||||
td { vertical-align: top; }
|
||||
|
||||
/* Set sub, sup without affecting line-height: gist.github.com/413930 */
|
||||
sub, sup { font-size: 75%; line-height: 0; position: relative; }
|
||||
sup { top: -0.5em; }
|
||||
sub { bottom: -0.25em; }
|
||||
|
||||
pre {
|
||||
/* www.pathf.com/blogs/2008/05/formatting-quoted-code-in-blog-posts-css21-white-space-pre-wrap/ */
|
||||
white-space: pre; white-space: pre-wrap; word-wrap: break-word;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
textarea { overflow: auto; } /* www.sitepoint.com/blogs/2010/08/20/ie-remove-textarea-scrollbars/ */
|
||||
|
||||
.ie6 legend, .ie7 legend { margin-left: -7px; }
|
||||
|
||||
/* Align checkboxes, radios, text inputs with their label by: Thierry Koblentz tjkdesign.com/ez-css/css/base.css */
|
||||
input[type="radio"] { vertical-align: text-bottom; }
|
||||
input[type="checkbox"] { vertical-align: bottom; }
|
||||
.ie7 input[type="checkbox"] { vertical-align: baseline; }
|
||||
.ie6 input { vertical-align: text-bottom; }
|
||||
|
||||
/* Hand cursor on clickable input elements */
|
||||
label, input[type="button"], input[type="submit"], input[type="image"], button { cursor: pointer; }
|
||||
|
||||
/* Webkit browsers add a 2px margin outside the chrome of form elements */
|
||||
button, input, select, textarea { margin: 0; }
|
||||
|
||||
/* Colors for form validity */
|
||||
input:valid, textarea:valid { }
|
||||
input:invalid, textarea:invalid {
|
||||
border-radius: 1px; -moz-box-shadow: 0px 0px 5px red; -webkit-box-shadow: 0px 0px 5px red; box-shadow: 0px 0px 5px red;
|
||||
}
|
||||
.no-boxshadow input:invalid, .no-boxshadow textarea:invalid { background-color: #f0dddd; }
|
||||
|
||||
|
||||
/* These selection declarations have to be separate
|
||||
No text-shadow: twitter.com/miketaylr/status/12228805301
|
||||
Also: hot pink! */
|
||||
::-moz-selection{ background: #FF5E99; color:#fff; text-shadow: none; }
|
||||
::selection { background:#FF5E99; color:#fff; text-shadow: none; }
|
||||
|
||||
/* j.mp/webkit-tap-highlight-color */
|
||||
a:link { -webkit-tap-highlight-color: #FF5E99; }
|
||||
|
||||
/* Make buttons play nice in IE:
|
||||
www.viget.com/inspire/styling-the-button-element-in-internet-explorer/ */
|
||||
button { width: auto; overflow: visible; }
|
||||
|
||||
/* Bicubic resizing for non-native sized IMG:
|
||||
code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ */
|
||||
.ie7 img { -ms-interpolation-mode: bicubic; }
|
||||
|
||||
/**
|
||||
* You might tweak these..
|
||||
*/
|
||||
|
||||
body, select, input, textarea {
|
||||
/* #444 looks better than black: twitter.com/H_FJ/statuses/11800719859 */
|
||||
color: #444;
|
||||
/* Set your base font here, to apply evenly */
|
||||
/* font-family: Georgia, serif; */
|
||||
}
|
||||
|
||||
/* Headers (h1, h2, etc) have no default font-size or margin; define those yourself */
|
||||
h1, h2, h3, h4, h5, h6 { font-weight: bold; }
|
||||
|
||||
a, a:active, a:visited { color: #607890; }
|
||||
a:hover { color: #036; }
|
||||
|
||||
|
||||
/**
|
||||
* Primary styles
|
||||
*
|
||||
* Author:
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Non-semantic helper classes: please define your styles before this section.
|
||||
*/
|
||||
|
||||
/* For image replacement */
|
||||
.ir { display: block; text-indent: -999em; overflow: hidden; background-repeat: no-repeat; text-align: left; direction: ltr; }
|
||||
|
||||
/* Hide for both screenreaders and browsers:
|
||||
css-discuss.incutio.com/wiki/Screenreader_Visibility */
|
||||
.hidden { display: none; visibility: hidden; }
|
||||
|
||||
/* Hide only visually, but have it available for screenreaders: by Jon Neal.
|
||||
www.webaim.org/techniques/css/invisiblecontent/ & j.mp/visuallyhidden */
|
||||
.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
|
||||
/* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: drupal.org/node/897638 */
|
||||
.visuallyhidden.focusable:active,
|
||||
.visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
|
||||
|
||||
/* Hide visually and from screenreaders, but maintain layout */
|
||||
.invisible { visibility: hidden; }
|
||||
|
||||
/* The Magnificent Clearfix: Updated to prevent margin-collapsing on child elements.
|
||||
j.mp/bestclearfix */
|
||||
.clearfix:before, .clearfix:after { content: "\0020"; display: block; height: 0; overflow: hidden; }
|
||||
.clearfix:after { clear: both; }
|
||||
/* Fix clearfix: blueprintcss.lighthouseapp.com/projects/15318/tickets/5-extra-margin-padding-bottom-of-page */
|
||||
.clearfix { zoom: 1; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Media queries for responsive design.
|
||||
*
|
||||
* These follow after primary styles so they will successfully override.
|
||||
*/
|
||||
|
||||
@media all and (orientation:portrait) {
|
||||
/* Style adjustments for portrait mode goes here */
|
||||
|
||||
}
|
||||
|
||||
@media all and (orientation:landscape) {
|
||||
/* Style adjustments for landscape mode goes here */
|
||||
|
||||
}
|
||||
|
||||
/* Grade-A Mobile Browsers (Opera Mobile, Mobile Safari, Android Chrome)
|
||||
consider this: www.cloudfour.com/css-media-query-for-mobile-is-fools-gold/ */
|
||||
@media screen and (max-device-width: 480px) {
|
||||
|
||||
|
||||
/* Uncomment if you don't want iOS and WinMobile to mobile-optimize the text for you: j.mp/textsizeadjust */
|
||||
/* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print styles.
|
||||
*
|
||||
* Inlined to avoid required HTTP connection: www.phpied.com/delay-loading-your-print-css/
|
||||
*/
|
||||
@media print {
|
||||
* { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important;
|
||||
-ms-filter: none !important; } /* Black prints faster: sanbeiji.com/archives/953 */
|
||||
a, a:visited { color: #444 !important; text-decoration: underline; }
|
||||
a[href]:after { content: " (" attr(href) ")"; }
|
||||
abbr[title]:after { content: " (" attr(title) ")"; }
|
||||
.ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */
|
||||
pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
|
||||
thead { display: table-header-group; } /* css-discuss.incutio.com/wiki/Printing_Tables */
|
||||
tr, img { page-break-inside: avoid; }
|
||||
@page { margin: 0.5cm; }
|
||||
p, h2, h3 { orphans: 3; widows: 3; }
|
||||
h2, h3{ page-break-after: avoid; }
|
||||
}
|
||||
|
||||
38
doc/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com)
|
||||
|
||||
# HTML5 Boilerplate documentation:
|
||||
|
||||
## Getting started
|
||||
|
||||
* [Usage](usage.md) — Overview of the project contents.
|
||||
* [FAQ](faq.md) — Frequently asked questions, along with their answers.
|
||||
|
||||
## The core of HTML5 Boilerplate
|
||||
|
||||
* [HTML](html.md) — A guide to the default HTML.
|
||||
* [CSS](css.md) — A guide to the default CSS.
|
||||
* [JavaScript](js.md) — A guide to the default JavaScript.
|
||||
* [.htaccess](htaccess.md) — All about the Apache web server config (also see
|
||||
our [alternative server configs](https://github.com/h5bp/server-configs)).
|
||||
* [crossdomain.xml](crossdomain.md) — An introduction to making use of
|
||||
crossdomain requests.
|
||||
* [Everything else](misc.md).
|
||||
|
||||
## Development
|
||||
|
||||
* [Contributing to HTML5 Boilerplate](contribute.md) — Guidelines on how to
|
||||
contribute effectively.
|
||||
* [Extending and customizing HTML5 Boilerplate](extend.md) — Going further with
|
||||
the boilerplate.
|
||||
|
||||
## Related projects
|
||||
|
||||
HTML5 Boilerplate has several related projects to help improve the performance
|
||||
of your site/app in various production environments.
|
||||
|
||||
* [Server configs](https://github.com/h5bp/server-configs) — Configs for
|
||||
non-Apache servers.
|
||||
* [Node build script](https://github.com/h5bp/node-build-script) — A
|
||||
feature-rich [grunt](https://github.com/cowboy/grunt) plugin.
|
||||
* [Ant build script](https://github.com/h5bp/ant-build-script) — The original
|
||||
HTML5 Boilerplate build script.
|
||||
104
doc/contribute.md
Normal file
@@ -0,0 +1,104 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# Contributing to HTML5 Boilerplate
|
||||
|
||||
♥ HTML5 Boilerplate and want to get involved? Thanks! There are plenty of ways
|
||||
you can help!
|
||||
|
||||
|
||||
## Reporting issues
|
||||
|
||||
A bug is a _demonstrable problem_ that is caused by the code in the
|
||||
repository.
|
||||
|
||||
Please read the following guidelines before you [report an issue](https://github.com/h5bp/html5-boilerplate/issues/):
|
||||
|
||||
1. **Use the GitHub issue search** — check if the issue has already been
|
||||
reported. If it has been, please comment on the existing issue.
|
||||
|
||||
2. **Check if the issue has been fixed** — the latest `master` or
|
||||
development branch may already contain a fix.
|
||||
|
||||
3. **Isolate the demonstrable problem** — make sure that the code in the
|
||||
project's repository is _definitely_ responsible for the issue. Create a
|
||||
[reduced test case](http://css-tricks.com/6263-reduced-test-cases/) - an
|
||||
extremely simple and immediately viewable example of the issue.
|
||||
|
||||
4. **Include a live example** — provide a link to your reduced test case
|
||||
when appropriate (e.g. if the issue is related to (front-end technologies).
|
||||
Please use [jsFiddle](http://jsfiddle.net) to host examples.
|
||||
|
||||
Please try to be as detailed as possible in your report too. What is your
|
||||
environment? What steps will reproduce the issue? What browser(s) and OS
|
||||
experience the problem? What would you expect to be the outcome? All these
|
||||
details will help people to assess and fix any potential bugs.
|
||||
|
||||
### Example of a good bug report:
|
||||
|
||||
> Short and descriptive title
|
||||
>
|
||||
> A summary of the issue and the browser/OS environment in which it occurs. If
|
||||
> suitable, include the steps required to reproduce the bug.
|
||||
>
|
||||
> 1. This is the first step
|
||||
> 2. This is the second step
|
||||
> 3. Further steps, etc.
|
||||
>
|
||||
> `<url>` (a link to the reduced test case)
|
||||
>
|
||||
> Any other information you want to share that is relevant to the issue being
|
||||
> reported. This might include the lines of code that you have identified as
|
||||
> causing the bug, and potential solutions (and your opinions on their
|
||||
> merits).
|
||||
|
||||
A good bug report shouldn't leave people needing to chase you up to get further
|
||||
information that is required to assess or fix the bug.
|
||||
|
||||
**[File a bug report](https://github.com/h5bp/html5-boilerplate/issues/)**
|
||||
|
||||
|
||||
## Pull requests
|
||||
|
||||
Good pull requests — patches, improvements, new features — are a fantastic
|
||||
help. They should remain focused in scope and avoid containing unrelated
|
||||
commits.
|
||||
|
||||
If your contribution involves a significant amount of work or substantial
|
||||
changes to any part of the project, please open an issue to discuss it first.
|
||||
|
||||
Please follow this process; it's the best way to get your work included in the
|
||||
project:
|
||||
|
||||
1. [Fork](http://help.github.com/fork-a-repo/) the project.
|
||||
|
||||
2. Clone your fork (`git clone
|
||||
https://github.com/<your-username>/html5-boilerplate.git`).
|
||||
|
||||
3. Add an `upstream` remote (`git remote add upstream
|
||||
https://github.com/h5bp/html5-boilerplate.git`).
|
||||
|
||||
4. Get the latest changes from upstream (e.g. `git pull upstream
|
||||
<dev-branch>`).
|
||||
|
||||
5. Create a new topic branch to contain your feature, change, or fix (`git
|
||||
checkout -b <topic-branch-name>`).
|
||||
|
||||
6. Make sure that your changes adhere to the current coding conventions used
|
||||
throughout the project - indentation, accurate comments, etc. Please update
|
||||
any documentation that is relevant to the change you are making.
|
||||
|
||||
7. Commit your changes in logical chunks; use git's [interactive
|
||||
rebase](https://help.github.com/articles/interactive-rebase) feature to tidy
|
||||
up your commits before making them public. Please adhere to these [git commit
|
||||
message
|
||||
guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
||||
or your pull request is unlikely be merged into the main project.
|
||||
|
||||
8. Locally merge (or rebase) the upstream branch into your topic branch.
|
||||
|
||||
9. Push your topic branch up to your fork (`git push origin
|
||||
<topic-branch-name>`).
|
||||
|
||||
10. [Open a Pull Request](http://help.github.com/send-pull-requests/) with a
|
||||
clear title and description. Please mention which browsers you tested in.
|
||||
21
doc/crossdomain.md
Normal file
@@ -0,0 +1,21 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# crossdomain.xml
|
||||
|
||||
A cross-domain policy file is an XML document that grants a web client—such as
|
||||
Adobe Flash Player, Adobe Reader, etc., permission to handle data across
|
||||
multiple domains. When a client hosts content from a particular source domain
|
||||
and that content makes requests directed towards a domain other than its own,
|
||||
the remote domain would need to host a cross-domain policy file that grants
|
||||
access to the source domain, allowing the client to continue with the
|
||||
transaction. Policy files grant read access to data, permit a client to include
|
||||
custom headers in cross-domain requests, and are also used with sockets to
|
||||
grant permissions for socket-based connections.
|
||||
|
||||
For full details, check out Adobe's article about the [cross-domain policy file
|
||||
specification](http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html)
|
||||
|
||||
Read the [Cross-domain policy file
|
||||
specification](http://learn.adobe.com/wiki/download/attachments/64389123/CrossDomain_PolicyFile_Specification.pdf?version=1)
|
||||
- (PDF, 129 KB)
|
||||
135
doc/css.md
Normal file
@@ -0,0 +1,135 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# The CSS
|
||||
|
||||
The HTML5 Boilerplate starting CSS includes:
|
||||
|
||||
* [Normalize.css](https://github.com/necolas/normalize.css).
|
||||
* Useful HTML5 Boilerplate defaults.
|
||||
* Common helpers.
|
||||
* Placeholder media queries.
|
||||
* Print styles.
|
||||
|
||||
This starting CSS does not rely on the presence of conditional classnames,
|
||||
conditional style sheets, or Modernizr. It is ready to use whatever your
|
||||
development preferences happen to be.
|
||||
|
||||
|
||||
## Normalize.css
|
||||
|
||||
Normalize.css is a modern, HTML5-ready alternative to CSS resets. It contains
|
||||
extensive inline documentation. Please refer to the [Normalize.css
|
||||
project](http://necolas.github.com/normalize.css/) for more information.
|
||||
|
||||
|
||||
## HTML5 Boilerplate defaults
|
||||
|
||||
This project includes a handful of base styles that build upon Normalize.css.
|
||||
These include:
|
||||
|
||||
* Basic typography settings to provide improved text readability by default.
|
||||
* Protection against unwanted `text-shadow` during text highlighting.
|
||||
* Tweaks to default image alignment, fieldsets, and textareas.
|
||||
* A pretty Chrome Frame prompt.
|
||||
|
||||
You are free to modify or add to these base styles as your project requires.
|
||||
|
||||
|
||||
## Common helpers
|
||||
|
||||
#### `.ir`
|
||||
|
||||
Add the `.ir` class to any element you are applying image-replacement to. When
|
||||
replacing an element's content with an image, make sure to also set a specific
|
||||
`background-image: url(pathtoimage.png);`, `width`, and `height` so that your
|
||||
replacement image appears.
|
||||
|
||||
#### `.hidden`
|
||||
|
||||
Add the `.hidden` class to any elements that you want to hide from all
|
||||
presentations, including screen readers. It could be an element that will be
|
||||
populated later with JavaScript or an element you will hide with JavaScript. Do
|
||||
not use this for SEO keyword stuffing. That is just not cool.
|
||||
|
||||
#### `.visuallyhidden`
|
||||
|
||||
Add the `.visuallyhidden` class to hide text from browsers but make it
|
||||
available for screen readers. You can use this to hide text that is specific to
|
||||
screen readers but that other users should not see. [About invisible
|
||||
content](http://www.webaim.org/techniques/css/invisiblecontent/), [Hiding
|
||||
content for
|
||||
accessibility](http://snook.ca/archives/html_and_css/hiding-content-for-accessibility),
|
||||
[HTML5 Boilerplate
|
||||
issue/research](https://github.com/h5bp/html5-boilerplate/issues/194/).
|
||||
|
||||
#### `.invisible`
|
||||
|
||||
Add the `.invisible` class to any element you want to hide without affecting
|
||||
layout. When you use `display: none` an element is effectively removed from the
|
||||
layout. But in some cases you want the element to simply be invisible while
|
||||
remaining in the flow and not affecting the positioning of surrounding
|
||||
content.
|
||||
|
||||
#### `.clearfix`
|
||||
|
||||
Adding `.clearfix` to an element will ensure that it always fully contains its
|
||||
floated children. There have been many variants of the clearfix hack over the
|
||||
years, and there are other hacks that can also help you to contain floated
|
||||
children, but the HTML5 Boilerplate currently uses the [micro
|
||||
clearfix](http://nicolasgallagher.com/micro-clearfix-hack/).
|
||||
|
||||
|
||||
## Media Queries
|
||||
|
||||
The boilerplate makes it easy to get started with a "Mobile First" and
|
||||
[Responsive Web
|
||||
Design](http://www.alistapart.com/articles/responsive-web-design/) approach to
|
||||
development. But it's worth remembering that there are [no silver
|
||||
bullets](http://www.cloudfour.com/css-media-query-for-mobile-is-fools-gold/).
|
||||
|
||||
We include a placeholder Media Queries to build up your mobile styles for wider
|
||||
viewports and high-resolution displays. It's recommended that you adapt these
|
||||
Media Queries based on the content of your site rather than mirroring the fixed
|
||||
dimensions of specific devices.
|
||||
|
||||
If you do not want to take a "Mobile First" approach, you can simply edit or
|
||||
remove these placeholder Media Queries. One possibility would be to work from
|
||||
wide viewports down and use `max-width` MQs instead, e.g., `@media only screen
|
||||
and (max-width: 480px)`.
|
||||
|
||||
Take a look into the [Mobile
|
||||
Boilerplate](https://github.com/h5bp/mobile-boilerplate) for features that are
|
||||
useful when developing mobile wep apps.
|
||||
|
||||
|
||||
## Print styles
|
||||
|
||||
* Print styles are inlined to [reduce the number of page
|
||||
requests](http://www.phpied.com/delay-loading-your-print-css/).
|
||||
* We strip all background colors and change the font color to dark gray and
|
||||
remove text-shadow. This is meant to help save printer ink.
|
||||
* Anchors do not need colors to indicate they are linked. They are underlined
|
||||
to indicate so.
|
||||
* Anchors and Abbreviations are expanded to indicate where users reading the
|
||||
printed page can refer to.
|
||||
* But we do not want to show link text for image replaced elements (given that
|
||||
they are primarily images).
|
||||
|
||||
### Paged media styles
|
||||
|
||||
* Paged media is supported only in a [few
|
||||
browsers](http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28Cascading_Style_Sheets%29#Grammar_and_rules).
|
||||
* Paged media support means browsers would know how to interpret instructions
|
||||
on breaking content into pages and on orphans/widows.
|
||||
* We use `page-break-inside: avoid;` to prevent an image and table row from
|
||||
being split into two different pages, so use the same `page-break-inside:
|
||||
avoid;` for that as well.
|
||||
* Headings should always appear with the text they are titles for. So, we
|
||||
ensure headings never appear in a different page than the text they describe
|
||||
by using `page-break-after: avoid;`.
|
||||
* We also apply a default margin for the page specified in `cm`.
|
||||
* We do not want [orphans and
|
||||
widows](http://en.wikipedia.org/wiki/Widows_and_orphans) to appear on pages
|
||||
you print. So, by defining `orphans: 3` and `widows: 3` you define the minimal
|
||||
number of words that every line should contain.
|
||||
507
doc/extend.md
Normal file
@@ -0,0 +1,507 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# Extend and customise HTML5 Boilerplate
|
||||
|
||||
Here is some useful advice for how you can make your project with HTML5
|
||||
Boilerplate even better. We don't want to include it all by default, as not
|
||||
everything fits with everyone's needs.
|
||||
|
||||
|
||||
## DNS prefetching
|
||||
|
||||
In short, DNS Prefetching is a method of informing the browser of domain names
|
||||
referenced on a site so that the client can resolve the DNS for those hosts,
|
||||
cache them, and when it comes time to use them, have a faster turn around on
|
||||
the request.
|
||||
|
||||
### Implicit prefetches
|
||||
|
||||
There is a lot of prefetching done for you automatically by the browser. When
|
||||
the browser encounters an anchor in your html that does not share the same
|
||||
domain name as the current location the browser requests, from the client OS,
|
||||
the IP address for this new domain. The client first checks its cache and
|
||||
then, lacking a cached copy, makes a request from a DNS server. These requests
|
||||
happen in the background and are not meant to block the rendering of the
|
||||
page.
|
||||
|
||||
The goal of this is that when the foreign IP address is finally needed it will
|
||||
already be in the client cache and will not block the loading of the foreign
|
||||
content. Less requests result in faster page load times. The perception of this
|
||||
is increased on a mobile platform where DNS latency can be greater.
|
||||
|
||||
#### Disable implicit prefetching
|
||||
|
||||
```html
|
||||
<meta http-equiv="x-dns-prefetch-control" content="off">
|
||||
```
|
||||
|
||||
Even with X-DNS-Prefetch-Control meta tag (or http header) browsers will still
|
||||
prefetch any explicit dns-prefetch links.
|
||||
|
||||
**_WARNING:_** THIS MAY MAKE YOUR SITE SLOWER IF YOU RELY ON RESOURCES FROM
|
||||
FOREIGN DOMAINS.
|
||||
|
||||
### Explicit prefetches
|
||||
|
||||
Typically the browser only scans the HTML for foreign domains. If you have
|
||||
resources that are outside of your HTML (a javascript request to a remote
|
||||
server or a CDN that hosts content that may not be present on every page of
|
||||
your site, for example) then you can queue up a domain name to be prefetched.
|
||||
|
||||
```html
|
||||
<link rel="dns-prefetch" href="//example.com">
|
||||
<link rel="dns-prefetch" href="//ajax.googleapis.com">
|
||||
```
|
||||
|
||||
You can use as many of these as you need, but it's best if they are all
|
||||
immediately after the [Meta
|
||||
Charset](https://developer.mozilla.org/en/HTML/Element/meta#attr-charset)
|
||||
element (which should go right at the top of the `head`), so the browser can
|
||||
act on them ASAP.
|
||||
|
||||
#### Common Prefetch Links
|
||||
|
||||
Amazon S3:
|
||||
|
||||
```html
|
||||
<link rel="dns-prefetch" href="//s3.amazonaws.com">
|
||||
```
|
||||
|
||||
Google APIs:
|
||||
|
||||
```html
|
||||
<link rel="dns-prefetch" href="//ajax.googleapis.com">
|
||||
```
|
||||
|
||||
Microsoft Ajax Content Delivery Network:
|
||||
|
||||
```html
|
||||
<link rel="dns-prefetch" href="//ajax.microsoft.com">
|
||||
<link rel="dns-prefetch" href="//ajax.aspnetcdn.com">
|
||||
```
|
||||
|
||||
### Browser support for DNS prefetching
|
||||
|
||||
Chrome, Firefox 3.5+, Safari 5+, Opera (Unknown), IE 9 (called "Pre-resolution"
|
||||
on blogs.msdn.com)
|
||||
|
||||
### Further reading about DNS prefetching
|
||||
|
||||
* https://developer.mozilla.org/En/Controlling_DNS_prefetching
|
||||
* http://dev.chromium.org/developers/design-documents/dns-prefetching
|
||||
* http://www.apple.com/safari/whats-new.html
|
||||
* http://blogs.msdn.com/b/ie/archive/2011/03/17/internet-explorer-9-network-performance-improvements.aspx
|
||||
* http://dayofjs.com/videos/22158462/web-browsers_alex-russel
|
||||
|
||||
|
||||
## Search
|
||||
|
||||
### Direct search spiders to your sitemap
|
||||
|
||||
[Learn how to make a sitemap](http://www.sitemaps.org/protocol.php)
|
||||
|
||||
```html
|
||||
<link rel="sitemap" type="application/xml" title="Sitemap" href="/sitemap.xml">
|
||||
```
|
||||
|
||||
### Hide pages from search engines
|
||||
|
||||
According to Heather Champ, former community manager at Flickr, you should not
|
||||
allow search engines to index your "Contact Us" or "Complaints" page if you
|
||||
value your sanity. This is an HTML-centric way of achieving that.
|
||||
|
||||
```html
|
||||
<meta name="robots" content="noindex">
|
||||
```
|
||||
|
||||
**_WARNING:_** DO NOT INCLUDE ON PAGES THAT SHOULD APPEAR IN SEARCH ENGINES.
|
||||
|
||||
### Firefox and IE Search Plugins
|
||||
|
||||
Sites with in-site search functionality should be strongly considered for a
|
||||
browser search plugin. A "search plugin" is an XML file which defines how your
|
||||
plugin behaves in the browser. [How to make a browser search
|
||||
plugin](http://www.google.com/search?ie=UTF-8&q=how+to+make+browser+search+plugin).
|
||||
|
||||
```html
|
||||
<link rel="search" title="" type="application/opensearchdescription+xml" href="">
|
||||
```
|
||||
|
||||
|
||||
## Internet Explorer
|
||||
|
||||
### Prompt users to switch to "Desktop Mode" in IE10 Metro
|
||||
|
||||
IE10 does not support plugins, such as Flash, in Metro mode. If your site
|
||||
requires plugins, you can let users know that via the X-UA-Compatible meta
|
||||
element, which will prompt them to switch to Desktop Mode.
|
||||
|
||||
```html
|
||||
<meta http-equiv="X-UA-Compatible" content="requiresActiveX=true">
|
||||
```
|
||||
|
||||
Here's what it looks like alongside H5BP's default X-UA-Compatible values:
|
||||
|
||||
```html
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1,requiresActiveX=true">
|
||||
```
|
||||
|
||||
You can find more information in [Microsoft's IEBlog post about prompting for
|
||||
plugin use in IE10 Metro
|
||||
Mode](http://blogs.msdn.com/b/ie/archive/2012/01/31/web-sites-and-a-plug-in-free-web.aspx).
|
||||
|
||||
### IE Pinned Sites (IE9+)
|
||||
|
||||
Enabling your application for pinning will allow IE9 users to add it to their
|
||||
Windows Taskbar and Start Menu. This comes with a range of new tools that you
|
||||
can easily configure with the elements below. See more [documentation on IE9
|
||||
Pinned Sites](http://msdn.microsoft.com/en-us/library/gg131029.aspx).
|
||||
|
||||
### Name the Pinned Site for Windows
|
||||
|
||||
Without this rule, Windows will use the page title as the name for your
|
||||
application.
|
||||
|
||||
```html
|
||||
<meta name="application-name" content="Sample Title">
|
||||
```
|
||||
|
||||
### Give your Pinned Site a tooltip
|
||||
|
||||
You know — a tooltip. A little textbox that appears when the user holds their
|
||||
mouse over your Pinned Site's icon.
|
||||
|
||||
```html
|
||||
<meta name="msapplication-tooltip" content="A description of what this site does.">
|
||||
```
|
||||
|
||||
### Set a default page for your Pinned Site
|
||||
|
||||
If the site should go to a specific URL when it is pinned (such as the
|
||||
homepage), enter it here. One idea is to send it to a special URL so you can
|
||||
track the number of pinned users, like so:
|
||||
`http://www.example.com/index.html?pinned=true`
|
||||
|
||||
```html
|
||||
<meta name="msapplication-starturl" content="http://www.example.com/index.html?pinned=true">
|
||||
```
|
||||
|
||||
### Recolor IE's controls manually for a Pinned Site
|
||||
|
||||
IE9+ will automatically use the overall color of your Pinned Site's favicon to
|
||||
shade its browser buttons. UNLESS you give it another color here. Only use
|
||||
named colors (`red`) or hex colors (`#ff0000`).
|
||||
|
||||
```html
|
||||
<meta name="msapplication-navbutton-color" content="#ff0000">
|
||||
```
|
||||
|
||||
### Manually set the window size of a Pinned Site
|
||||
|
||||
If the site should open at a certain window size once pinned, you can specify
|
||||
the dimensions here. It only supports static pixel dimensions. 800x600
|
||||
minimum.
|
||||
|
||||
```html
|
||||
<meta name="msapplication-window" content="width=800;height=600">
|
||||
```
|
||||
|
||||
### Jump List "Tasks" for Pinned Sites
|
||||
|
||||
Add Jump List Tasks that will appear when the Pinned Site's icon gets a
|
||||
right-click. Each Task goes to the specified URL, and gets its own mini icon
|
||||
(essentially a favicon, a 16x16 .ICO). You can add as many of these as you
|
||||
need.
|
||||
|
||||
```html
|
||||
<meta name="msapplication-task" content="name=Task 1;action-uri=http://host/Page1.html;icon-uri=http://host/icon1.ico">
|
||||
<meta name="msapplication-task" content="name=Task 2;action-uri=http://microsoft.com/Page2.html;icon-uri=http://host/icon2.ico">
|
||||
```
|
||||
|
||||
### (Windows 8) High quality visuals for Pinned Sites
|
||||
|
||||
Windows 8 adds the ability for you to provide a PNG tile image and specify the
|
||||
tile's background color. [Full details on the IE
|
||||
blog](http://blogs.msdn.com/b/ie/archive/2012/06/08/high-quality-visuals-for-pinned-sites-in-windows-8.aspx).
|
||||
|
||||
* Create a 144x144 image of your site icon, filling all of the canvas, and
|
||||
using a transparent background.
|
||||
* Save this image as a 32-bit PNG and optimize it without reducing
|
||||
colour-depth. It can be named whatever you want (e.g. `metro-tile.png`).
|
||||
* To reference the tile and its color, add the HTML `meta` elements described
|
||||
in the IE Blog post.
|
||||
|
||||
### (Windows 8) Badges for Pinned Sites
|
||||
|
||||
IE10 will poll an XML document for badge information to display on your app's
|
||||
tile in the Start screen. The user will be able to receive these badge updates
|
||||
even when your app isn't actively running. The badge's value can be a number,
|
||||
or one of a predefined list of glyphs.
|
||||
|
||||
* [Tutorial on IEBlog with link to badge XML schema](http://blogs.msdn.com/b/ie/archive/2012/04/03/pinned-sites-in-windows-8.aspx)
|
||||
* [Available badge values](http://msdn.microsoft.com/en-us/library/ie/br212849.aspx)
|
||||
|
||||
```html
|
||||
<meta name="msapplication-badge" value="frequency=NUMBER_IN_MINUTES;polling-uri=http://www.example.com/path/to/file.xml">
|
||||
```
|
||||
|
||||
### Suppress IE6 image toolbar
|
||||
|
||||
Kill IE6's pop-up-on-mouseover toolbar for images that can interfere with
|
||||
certain designs and be pretty distracting in general.
|
||||
|
||||
```html
|
||||
<meta http-equiv="imagetoolbar" content="false">
|
||||
```
|
||||
|
||||
|
||||
## Social Networks
|
||||
|
||||
### Facebook Open Graph data
|
||||
|
||||
You can control the information that Facebook and others display when users
|
||||
share your site. Below are just the most basic data points you might need. For
|
||||
specific content types (including "website"), see [Facebook's built-in Open
|
||||
Graph content
|
||||
templates](https://developers.facebook.com/docs/opengraph/objects/builtin/).
|
||||
Take full advantage of Facebook's support for complex data and activity by
|
||||
following the [Open Graph
|
||||
tutorial](https://developers.facebook.com/docs/opengraph/tutorial/).
|
||||
|
||||
```html
|
||||
<meta property="og:title" content="">
|
||||
<meta property="og:description" content="">
|
||||
<meta property="og:image" content="">
|
||||
```
|
||||
|
||||
### Twitter Cards
|
||||
|
||||
Twitter provides a snippet specification that serves a similar purpose to Open
|
||||
Graph. In fact, Twitter will use Open Graph when Cards is not available. Note
|
||||
that, as of this writing, Twitter requires that app developers activate Cards
|
||||
on a per-domain basis. You can read more about the various snippet formats
|
||||
and application process in the [official Twitter Cards
|
||||
documentation](https://dev.twitter.com/docs/cards).
|
||||
|
||||
```html
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:site" content="@site_account">
|
||||
<meta name="twitter:creator" content="@individual_account">
|
||||
<meta name="twitter:url" content="http://www.example.com/path/to/page.html">
|
||||
<meta name="twitter:title" content="">
|
||||
<meta name="twitter:description" content="">
|
||||
<meta name="twitter:image" content="http://www.example.com/path/to/image.jpg">
|
||||
```
|
||||
|
||||
|
||||
## URLs
|
||||
|
||||
### Canonical URL
|
||||
|
||||
Signal to search engines and others "Use this URL for this page!" Useful when
|
||||
parameters after a `#` or `?` is used to control the display state of a page.
|
||||
`http://www.example.com/cart.html?shopping-cart-open=true` can be indexed as
|
||||
the cleaner, more accurate `http://www.example.com/cart.html`.
|
||||
|
||||
```html
|
||||
<link rel="canonical" href="">
|
||||
```
|
||||
|
||||
### Official shortlink
|
||||
|
||||
Signal to the world "This is the shortened URL to use this page!" Poorly
|
||||
supported at this time. Learn more by reading the [article about shortlinks on
|
||||
the Microformats wiki](http://microformats.org/wiki/rel-shortlink).
|
||||
|
||||
```html
|
||||
<link rel="shortlink" href="h5bp.com">
|
||||
```
|
||||
|
||||
|
||||
## News Feeds
|
||||
|
||||
### RSS
|
||||
|
||||
Have an RSS feed? Link to it here. Want to [learn how to write an RSS feed from
|
||||
scratch](http://www.rssboard.org/rss-specification)?
|
||||
|
||||
```html
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml">
|
||||
```
|
||||
|
||||
### Atom
|
||||
|
||||
Atom is similar to RSS, and you might prefer to use it instead of or in
|
||||
addition to it. [See what Atom's all
|
||||
about](http://www.atomenabled.org/developers/syndication/).
|
||||
|
||||
```html
|
||||
<link rel="alternate" type="application/atom+xml" title="Atom" href="/atom.xml">
|
||||
```
|
||||
|
||||
### Pingbacks
|
||||
|
||||
Your server may be notified when another site links to yours. The href
|
||||
attribute should contain the location of your pingback service.
|
||||
|
||||
```html
|
||||
<link rel="pingback" href="">
|
||||
```
|
||||
|
||||
* High-level explanation: http://codex.wordpress.org/Introduction_to_Blogging#Pingbacks
|
||||
* Step-by-step example case: http://www.hixie.ch/specs/pingback/pingback-1.0#TOC5
|
||||
* PHP pingback service: http://blog.perplexedlabs.com/2009/07/15/xmlrpc-pingbacks-using-php/
|
||||
|
||||
|
||||
## App Stores
|
||||
|
||||
### Install a Chrome Web Store app
|
||||
|
||||
Users can install a Chrome app directly from your website, as long as the app
|
||||
and site have been associated via Google's Webmaster Tools. Read more on
|
||||
[Chrome Web Store's Inline Installation
|
||||
docs](https://developers.google.com/chrome/web-store/docs/inline_installation).
|
||||
|
||||
```html
|
||||
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/APP_ID">
|
||||
```
|
||||
|
||||
### Smart App Banners in iOS 6 Safari
|
||||
|
||||
Stop bothering everyone with gross modals advertising your entry in the App Store.
|
||||
This bit of code will unintrusively allow the user the option to download your iOS
|
||||
app, or open it with some data about the user's current state on the website.
|
||||
|
||||
```html
|
||||
<meta name="apple-itunes-app" content="app-id=APP_ID,app-argument=SOME_TEXT">
|
||||
```
|
||||
|
||||
## Google Analytics augments
|
||||
|
||||
### More tracking settings
|
||||
|
||||
The [optimized Google Analytics
|
||||
snippet](http://mathiasbynens.be/notes/async-analytics-snippet) included with
|
||||
HTML5 Boilerplate includes something like this:
|
||||
|
||||
```js
|
||||
var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
|
||||
```
|
||||
|
||||
In case you need more settings, just extend the array literal instead of
|
||||
[`.push()`ing to the
|
||||
array](http://mathiasbynens.be/notes/async-analytics-snippet#dont-push-it)
|
||||
afterwards:
|
||||
|
||||
```js
|
||||
var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview'], ['_setAllowAnchor', true]];
|
||||
```
|
||||
|
||||
### Anonymize IP addresses
|
||||
|
||||
In some countries, no personal data may be transferred outside jurisdictions
|
||||
that do not have similarly strict laws (i.e. from Germany to outside the EU).
|
||||
Thus a webmaster using the Google Analytics script may have to ensure that no
|
||||
personal (trackable) data is transferred to the US. You can do that with [the
|
||||
`_gat.anonymizeIp`
|
||||
option](http://code.google.com/apis/analytics/docs/gaJS/gaJSApi_gat.html#_gat._anonymizeIp).
|
||||
In use it looks like this:
|
||||
|
||||
```js
|
||||
var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_gat._anonymizeIp'], ['_trackPageview']];
|
||||
```
|
||||
|
||||
### Track jQuery AJAX requests in Google Analytics
|
||||
|
||||
An article by @JangoSteve explains how to [track jQuery AJAX requests in Google
|
||||
Analytics](http://www.alfajango.com/blog/track-jquery-ajax-requests-in-google-analytics/).
|
||||
|
||||
Add this to `plugins.js`:
|
||||
|
||||
```js
|
||||
/*
|
||||
* Log all jQuery AJAX requests to Google Analytics
|
||||
* See: http://www.alfajango.com/blog/track-jquery-ajax-requests-in-google-analytics/
|
||||
*/
|
||||
if (typeof _gaq !== "undefined" && _gaq !== null) {
|
||||
$(document).ajaxSend(function(event, xhr, settings){
|
||||
_gaq.push(['_trackPageview', settings.url]);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Track JavaScript errors in Google Analytics
|
||||
|
||||
Add this function after `_gaq` is defined:
|
||||
|
||||
```js
|
||||
(function(window){
|
||||
var undefined,
|
||||
link = function (href) {
|
||||
var a = window.document.createElement('a');
|
||||
a.href = href;
|
||||
return a;
|
||||
};
|
||||
window.onerror = function (message, file, row) {
|
||||
var host = link(file).hostname;
|
||||
_gaq.push([
|
||||
'_trackEvent',
|
||||
(host == window.location.hostname || host == undefined || host == '' ? '' : 'external ') + 'error',
|
||||
message, file + ' LINE: ' + row, undefined, undefined, true
|
||||
]);
|
||||
};
|
||||
}(window));
|
||||
```
|
||||
|
||||
### Track page scroll
|
||||
|
||||
Add this function after `_gaq` is defined:
|
||||
|
||||
```js
|
||||
$(function(){
|
||||
var isDuplicateScrollEvent,
|
||||
scrollTimeStart = new Date,
|
||||
$window = $(window),
|
||||
$document = $(document),
|
||||
scrollPercent;
|
||||
|
||||
$window.scroll(function() {
|
||||
scrollPercent = Math.round(100 * ($window.height() + $window.scrollTop())/$document.height());
|
||||
if (scrollPercent > 90 && !isDuplicateScrollEvent) { //page scrolled to 90%
|
||||
isDuplicateScrollEvent = 1;
|
||||
_gaq.push(['_trackEvent', 'scroll',
|
||||
'Window: ' + $window.height() + 'px; Document: ' + $document.height() + 'px; Time: ' + Math.round((new Date - scrollTimeStart )/1000,1) + 's',
|
||||
undefined, undefined, true
|
||||
]);
|
||||
}
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
* Use [HTML5
|
||||
polyfills](https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills).
|
||||
|
||||
* Use [Microformats](http://microformats.org/wiki/Main_Page) (via
|
||||
[microdata](http://microformats.org/wiki/microdata)) for optimum search
|
||||
results
|
||||
[visibility](http://googlewebmastercentral.blogspot.com/2009/05/introducing-rich-snippets.html).
|
||||
|
||||
* If you're building a web app you may want [native style momentum scrolling in
|
||||
iOS5](http://johanbrook.com/browsers/native-momentum-scrolling-ios-5/) using
|
||||
`-webkit-overflow-scrolling: touch`.
|
||||
|
||||
* Avoid development/stage websites "leaking" into SERPs (search engine results
|
||||
page) by [implementing X-Robots-tag
|
||||
headers](https://github.com/h5bp/html5-boilerplate/issues/804).
|
||||
|
||||
* Screen readers currently have less-than-stellar support for HTML5 but the JS
|
||||
script [accessifyhtml5.js](https://github.com/yatil/accessifyhtml5.js) can
|
||||
help increase accessibility by adding ARIA roles to HTML5 elements.
|
||||
|
||||
|
||||
*Many thanks to [Brian Blakely](https://github.com/brianblakely) for
|
||||
contributing much of this information.*
|
||||
77
doc/faq.md
Normal file
@@ -0,0 +1,77 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# Frequently asked questions
|
||||
|
||||
### Why is the URL for jQuery without "http"?
|
||||
|
||||
This is an intentional use of [protocol-relative
|
||||
URLs](http://paulirish.com/2010/the-protocol-relative-url/)
|
||||
|
||||
**N.B.** Using a protocol-relative URL for files that exist on a CDN is
|
||||
problematic when you try to view your local files directly in the browser. The
|
||||
browser will attempt to fetch the file from your local file system. We
|
||||
recommend that you use a local server to test your pages (or Dropbox). This can
|
||||
be done using Python by running `python -m SimpleHTTPServer` from your local
|
||||
directory, using Ruby by installing and running
|
||||
[asdf](https://rubygems.org/gems/asdf), and by installing any one of XAMPP,
|
||||
MAMP, or WAMP.
|
||||
|
||||
|
||||
### Why don't you automatically load the latest version of jQuery from the Google CDN?
|
||||
|
||||
1. The latest version of jQuery may not be compatible with the existing
|
||||
plugins/code on the site. Version updating should be an intentional
|
||||
decision.
|
||||
2. The latest version has a very short `max-age=3600` compares to the specific
|
||||
version of `max-age=31536000`, which means you won't get the benefits of
|
||||
long-term caching.
|
||||
|
||||
|
||||
### Why is the Google Analytics code at the bottom? Google recommends it be placed the `head`.
|
||||
|
||||
The advantage to placing it in the `head` is that you will track a user's
|
||||
pageview even if they leave the page before it has been fully loaded. However,
|
||||
putting the code at the bottom keeps all the scripts together and reinforces
|
||||
that scripts at the bottom are the right move.
|
||||
|
||||
|
||||
### How can I integrate [Twitter Bootstrap](http://twitter.github.com/bootstrap/) with HTML5 Boilerplate?
|
||||
|
||||
You can use [Initializr](http://initializr.com) to create a custom build that
|
||||
includes HTML5 Boilerplate with Twitter Bootstrap.
|
||||
|
||||
Read more about how [HTML5 Boilerplate and Twitter Bootstrap complement each
|
||||
other](http://www.quora.com/Is-Bootstrap-a-complement-OR-an-alternative-to-HTML5-Boilerplate-or-viceversa/answer/Nicolas-Gallagher).
|
||||
|
||||
|
||||
### How do I prevent phone numbers looking twice as large and having a Skype highlight?
|
||||
|
||||
If this is occurring, it is because a user has the Skype browser extension
|
||||
installed.
|
||||
|
||||
Use the following CSS to prevent Skype from formatting the numbers on your
|
||||
page:
|
||||
|
||||
```css
|
||||
span.skype_pnh_container {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
span.skype_pnh_print_container {
|
||||
display: inline !important;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Do I need to upgrade my sites each time a new version of HTML5 Boilerplate is released?
|
||||
|
||||
No. You don't normally replace the foundations of a house once it has been
|
||||
built. There is nothing stopping you from trying to work in the latest changes
|
||||
but you'll have to assess the costs/benefits of doing so.
|
||||
|
||||
|
||||
### Where can I get help for support questions?
|
||||
|
||||
Please ask for help on
|
||||
[StackOverflow](http://stackoverflow.com/questions/tagged/html5boilerplate).
|
||||
323
doc/htaccess.md
Normal file
@@ -0,0 +1,323 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# .htaccess
|
||||
|
||||
In Apache HTTP server, `.htaccess` (hypertext access) is the configuration file
|
||||
that allows for web server configuration. HTML5 Boilerplate includes a number
|
||||
of best practice server rules for making web pages fast and secure, these rules
|
||||
can be applied by configuring `.htaccess` file.
|
||||
|
||||
**You'll want to have these modules enabled for optimum performance:**
|
||||
|
||||
* `mod_setenvif.c` (setenvif_module)
|
||||
* `mod_headers.c` (headers_module)
|
||||
* `mod_deflate.c` (deflate_module)
|
||||
* `mod_filter.c` (filter_module)
|
||||
* `mod_expires.c` (expires_module)
|
||||
* `mod_rewrite.c` (rewrite_module)
|
||||
|
||||
|
||||
## On Windows
|
||||
|
||||
You've got a couple of options that depend on how you installed Apache.
|
||||
|
||||
1. **WampServer**. This is by far the simplest option. If you have installed
|
||||
WampServer just click on the icon in the task bar, hover over the Apache
|
||||
section in the menu that comes up and then hover over the modules section.
|
||||
You will be presented with a list of modules. Simply click on a module name
|
||||
to enable it (or disable it if it is already enabled). A check mark next to
|
||||
a module indicates that it is enabled. WampServer will automatically restart
|
||||
the Apache service after you enable a module.
|
||||
|
||||
2. **Manually editing `httpd.conf`**. This assumes that you have manually
|
||||
installed Apache. You will need to locate the `httpd.conf` file which is
|
||||
normally in the `conf` folder in the folder where you installed Apache (for
|
||||
example `C:\apache\conf\httpd.conf`). Open up this file in a text editor. Near
|
||||
the top (after a bunch of comments) you will see a long list of modules. Check
|
||||
to make sure that the modules listed above are not commented out. If they
|
||||
are, go ahead and uncomment them and restart Apache.
|
||||
|
||||
That's it, you're done!
|
||||
|
||||
|
||||
## On Linux
|
||||
|
||||
These instructions should work on any distribution where `apt-get` has been
|
||||
used to install Apache.
|
||||
|
||||
1. Open up a terminal and type the following command. Enter your password when
|
||||
prompted.
|
||||
|
||||
`sudo a2enmod setenvif headers deflate filter expires rewrite include`
|
||||
|
||||
1. Restart apache by using the following command so the new configuration takes
|
||||
effect.
|
||||
|
||||
`sudo /etc/init.d/apache2 restart`
|
||||
|
||||
That's it, you're done!
|
||||
|
||||
|
||||
## On Mac
|
||||
|
||||
Coming soon...
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
Do not turn off your ServerSignature (i.e., the `Server:` HTTP header). Serious
|
||||
attackers can use other kinds of fingerprinting methods to figure out the
|
||||
actual server and components running behind a port. Instead, as a site owner,
|
||||
you should keep track of what's listening on ports on hosts that you control.
|
||||
Run a periodic scanner to make sure nothing suspicious is running on a host you
|
||||
control, and use the ServerSignature to determine if this is the web server and
|
||||
version that you expect.
|
||||
|
||||
|
||||
## Performance
|
||||
|
||||
### Configure ETags
|
||||
|
||||
```apache
|
||||
FileETag None
|
||||
```
|
||||
|
||||
Entity tags (ETags) is a mechanism that web servers and browsers use to
|
||||
determine whether the component in the browser's cache matches the one on the
|
||||
origin server. (An "entity" is another word a "component": images, scripts,
|
||||
stylesheets, etc.) ETags were added to provide a mechanism for validating
|
||||
entities that is more flexible than the last-modified date. An `ETag` is a
|
||||
string that uniquely identifies a specific version of a component. The only
|
||||
format constraints are that the string be quoted. The origin server specifies
|
||||
the component's `ETag` using the `ETag` response header.
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT
|
||||
ETag: "10c24bc-4ab-457e1c1f"
|
||||
Content-Length: 12195
|
||||
```
|
||||
|
||||
Later, if the browser has to validate a component, it uses the `If-None-Match`
|
||||
header to pass the `ETag` back to the origin server. If the ETags match, a 304
|
||||
status code is returned reducing the response by 12195 bytes for this
|
||||
example.
|
||||
|
||||
```http
|
||||
GET /i/yahoo.gif HTTP/1.1
|
||||
Host: us.yimg.com
|
||||
If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT
|
||||
If-None-Match: "10c24bc-4ab-457e1c1f"
|
||||
HTTP/1.1 304 Not Modified
|
||||
```
|
||||
|
||||
The problem with ETags is that they typically are constructed using attributes
|
||||
that make them unique to a specific server hosting a site. ETags won't match
|
||||
when a browser gets the original component from one server and later tries to
|
||||
validate that component on a different server, a situation that is all too
|
||||
common on web sites that use a cluster of servers to handle requests. By
|
||||
default, both Apache and IIS embed data in the ETag that dramatically reduces
|
||||
the odds of the validity test succeeding on web sites with multiple servers.
|
||||
|
||||
The ETag format for Apache 1.3 and 2.x is inode-size-timestamp. Although a
|
||||
given file may reside in the same directory across multiple servers, and have
|
||||
the same file size, permissions, timestamp, etc., its inode is different from
|
||||
one server to the next.
|
||||
|
||||
IIS 5.0 and 6.0 have a similar issue with ETags. The format for ETags on IIS is
|
||||
Filetimestamp:ChangeNumber. A ChangeNumber is a counter used to track
|
||||
configuration changes to IIS. It's unlikely that the ChangeNumber is the same
|
||||
across all IIS servers behind a web site.
|
||||
|
||||
The end result is ETags generated by Apache and IIS for the exact same
|
||||
component won't match from one server to another. If the ETags don't match, the
|
||||
user doesn't receive the small, fast 304 response that ETags were designed for;
|
||||
instead, they'll get a normal 200 response along with all the data for the
|
||||
component. If you host your web site on just one server, this isn't a problem.
|
||||
But if you have multiple servers hosting your web site, and you're using Apache
|
||||
or IIS with the default ETag configuration, your users are getting slower
|
||||
pages, your servers have a higher load, you're consuming greater bandwidth, and
|
||||
proxies aren't caching your content efficiently. Even if your components have a
|
||||
far future Expires header, a conditional GET request is still made whenever the
|
||||
user hits Reload or Refresh.
|
||||
|
||||
If you're not taking advantage of the flexible validation model that ETags
|
||||
provide, it's better to just remove the ETag altogether. The Last-Modified
|
||||
header validates based on the component's timestamp. And removing the ETag
|
||||
reduces the size of the HTTP headers in both the response and subsequent
|
||||
requests. This Microsoft Support article describes how to remove ETags. In
|
||||
Apache, this is done by simply adding the above line to your Apache
|
||||
configuration file.
|
||||
|
||||
|
||||
### Gzip Components
|
||||
|
||||
Compression reduces response times by reducing the size of the HTTP response.
|
||||
|
||||
Starting with HTTP/1.1, web clients indicate support for compression with the
|
||||
Accept-Encoding header in the HTTP request.
|
||||
|
||||
```
|
||||
Accept-Encoding: gzip, deflate
|
||||
```
|
||||
|
||||
If the web server sees this header in the request, it may compress the response
|
||||
using one of the methods listed by the client. The web server notifies the web
|
||||
client of this via the Content-Encoding header in the response.
|
||||
|
||||
```
|
||||
Content-Encoding: gzip
|
||||
```
|
||||
|
||||
Gzip is the most popular and effective compression method at this time. It was
|
||||
developed by the GNU project and standardized by RFC 1952. The only other
|
||||
compression format you're likely to see is deflate, but it's less effective and
|
||||
less popular.
|
||||
|
||||
Gzipping generally reduces the response size by about 70%. Approximately 90% of
|
||||
today's Internet traffic travels through browsers that claim to support gzip.
|
||||
If you use Apache, the module configuring gzip depends on your version: Apache
|
||||
1.3 uses `mod_gzip` while Apache 2.x uses `mod_deflate`.
|
||||
|
||||
There are known issues with browsers and proxies that may cause a mismatch in
|
||||
what the browser expects and what it receives with regard to compressed
|
||||
content. Fortunately, these edge cases are dwindling as the use of older
|
||||
browsers drops off. The Apache modules help out by adding appropriate Vary
|
||||
response headers automatically.
|
||||
|
||||
Servers choose what to gzip based on file type, but are typically too limited
|
||||
in what they decide to compress. Most web sites gzip their HTML documents. It's
|
||||
also worthwhile to gzip your scripts and stylesheets, but many web sites miss
|
||||
this opportunity. In fact, it's worthwhile to compress any text response
|
||||
including XML and JSON. Image and PDF files should not be gzipped because they
|
||||
are already compressed. Trying to gzip them not only wastes CPU but can
|
||||
potentially increase file sizes.
|
||||
|
||||
Gzipping as many appropriate file types as possible is an easy way to reduce
|
||||
page weight and accelerate the user experience.
|
||||
|
||||
|
||||
### Cache busting
|
||||
|
||||
A first-time visitor to your page may have to make several HTTP requests, but
|
||||
by using the Expires header you make those components cacheable. This avoids
|
||||
unnecessary HTTP requests on subsequent page views. Expires headers are most
|
||||
often used with images, but they should be used on all components including
|
||||
scripts, stylesheets, etc.
|
||||
|
||||
Traditionally, if you use a far future Expires header you have to change the
|
||||
component's filename whenever the component changes.
|
||||
|
||||
The H5BP `.htaccess` has built-in filename cache busting. To use it, uncomment
|
||||
the relevant lines in the `.htaccess` file.
|
||||
|
||||
Doing so will route all requests for `/path/filename.20120101.ext` to
|
||||
`/path/filename.ext`. To use this, just add a time-stamp number (or your own
|
||||
numbered versioning system) into your resource filenames in your HTML source
|
||||
whenever you update those resources.
|
||||
|
||||
#### Example:
|
||||
|
||||
```html
|
||||
<script src="/js/myscript.20120305.js"></script>
|
||||
<script src="/js/jqueryplugin.45.js"></script>
|
||||
<link rel="stylesheet" href="css/somestyle.49559939932.css">
|
||||
<link rel="stylesheet" href="css/anotherstyle.2.css">
|
||||
```
|
||||
|
||||
**N.B. You do not have to rename the resource on the filesystem.** All you have
|
||||
to do is add the timestamp number to the filename in your HTML source. The
|
||||
`.htaccess` directive will serve up the proper file.
|
||||
|
||||
Traditional cache busting involved adding a query string to the end of your
|
||||
JavaScript or CSS filename whenever you updated it.
|
||||
|
||||
```html
|
||||
<script src="/js/all.js?v=12"></script>
|
||||
```
|
||||
|
||||
However, as [Steve Souders](http://stevesouders.com/) explains in [*Revving
|
||||
Filenames: don’t use
|
||||
querystring*](http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/),
|
||||
the query string approach is not always reliable for clients behind a Squid
|
||||
Proxy Server.
|
||||
|
||||
|
||||
## Trailing slash redirects
|
||||
|
||||
Trailing slash redirects can be done by adding one of the options below in `.htaccess`.
|
||||
|
||||
### Option 1
|
||||
Rewrite `domain.com/foo` -> `domain.com/foo/`.
|
||||
|
||||
```apache
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
|
||||
RewriteRule ^(.*)$ $1/ [R=301,L]
|
||||
```
|
||||
|
||||
### Option 2
|
||||
Rewrite `domain.com/foo/` -> `domain.com/foo`
|
||||
|
||||
```apache
|
||||
RewriteRule ^(.*)/$ $1 [R=301,L]
|
||||
```
|
||||
|
||||
Here are some tips to show you how to integrate the rewrite rules with
|
||||
different CMS tools. There are four areas you need to look out for:
|
||||
|
||||
### 1. Keep a backup
|
||||
|
||||
If you use trailing slash redirects on an existing site, always keep a backup
|
||||
of your `.htaccess` and test thoroughly on your staging server before using it on
|
||||
a production server.
|
||||
|
||||
### 2. Don't replace existing rules, merge
|
||||
|
||||
For example, if you use CodeIgniter you may have existing URL rewrite rules like:
|
||||
|
||||
```apache
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1
|
||||
```
|
||||
|
||||
Merge the above with H5BP rules below:
|
||||
|
||||
```apache
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
|
||||
RewriteRule ^(.*)$ $1/ [R=301,L]
|
||||
```
|
||||
|
||||
### 3. Be careful of the order
|
||||
|
||||
Make sure you test thoroughly in your staging environment. For the above
|
||||
example, the order is add trailing slash first, and add your existing rule
|
||||
after:
|
||||
|
||||
```apache
|
||||
# this adds trailing slash
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
|
||||
RewriteRule ^(.*)$ $1/ [R=301,L]
|
||||
|
||||
# this gets rid of index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1
|
||||
```
|
||||
|
||||
### 4. Double-check `RewriteBase` path is correct
|
||||
|
||||
Make sure your `RewriteBase` path points to the correct location and sits above
|
||||
any rewrite rules. This usually happens to those have WordPress and ran the
|
||||
auto install. For instance, if you have a site at `example.com/blog`, your
|
||||
RewriteBase may look like:
|
||||
|
||||
```apache
|
||||
RewriteBase /blog/
|
||||
```
|
||||
|
||||
If you already have a working RewriteBase, keep that and don't remove it.
|
||||
170
doc/html.md
Normal file
@@ -0,0 +1,170 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# The HTML
|
||||
|
||||
## Conditional `html` classes
|
||||
|
||||
A series of IE conditional comments apply the relevant IE-specific classes to
|
||||
the `html` tag. This provides one method of specifying CSS fixes for specific
|
||||
legacy versions of IE. While you may or may not choose to use this technique in
|
||||
your project code, HTML5 Boilerplate's default CSS does not rely on it.
|
||||
|
||||
When using the conditional classes technique, applying classes to the `html`
|
||||
element has several benefits:
|
||||
|
||||
* It avoids a [file blocking
|
||||
issue](http://webforscher.wordpress.com/2010/05/20/ie-6-slowing-down-ie-8/)
|
||||
discovered by Stoyan Stefanov and Markus Leptien.
|
||||
* It avoids the need for an empty comment that also fixes the above issue.
|
||||
* CMSes like WordPress and Drupal use the body class more heavily. This makes
|
||||
integrating there a touch simpler.
|
||||
* It still validates as HTML5.
|
||||
* It uses the same element as Modernizr (and Dojo). That feels nice.
|
||||
* It can improve the clarity of code in multi-developer teams.
|
||||
|
||||
|
||||
## The `no-js` class
|
||||
|
||||
Allows you to more easily explicitly add custom styles when JavaScript is
|
||||
disabled (`no-js`) or enabled (`js`). More here: [Avoiding the
|
||||
FOUC](http://paulirish.com/2009/avoiding-the-fouc-v3/).
|
||||
|
||||
|
||||
## The order of meta tags, and `<title>`
|
||||
|
||||
As recommended by [the HTML5
|
||||
spec](http://www.whatwg.org/specs/web-apps/current-work/complete/semantics.html#charset)
|
||||
(4.2.5.5 Specifying the document's character encoding), add your charset
|
||||
declaration early (before any ASCII art ;) to avoid a potential
|
||||
[encoding-related security
|
||||
issue](http://code.google.com/p/doctype/wiki/ArticleUtf7) in IE. It should come
|
||||
in the first [1024
|
||||
bytes](http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#charset).
|
||||
|
||||
The charset should also come before the `<title>` tag, due to [potential XSS
|
||||
vectors](http://code.google.com/p/doctype-mirror/wiki/ArticleUtf7).
|
||||
|
||||
The meta tag for compatibility mode [needs to be before all elements except
|
||||
title and meta](http://h5bp.com/f "Defining Document Compatibility - MSDN").
|
||||
And that same meta tag can only be invoked for Google Chrome Frame if it is
|
||||
within the [first 1024
|
||||
bytes](http://code.google.com/p/chromium/issues/detail?id=23003).
|
||||
|
||||
|
||||
## X-UA-Compatible
|
||||
|
||||
This makes sure the latest version of IE is used in versions of IE that contain
|
||||
multiple rendering engines. Even if a site visitor is using IE8 or IE9, it's
|
||||
possible that they're not using the latest rendering engine their browser
|
||||
contains. To fix this, use:
|
||||
|
||||
```html
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
```
|
||||
|
||||
The `meta` tag tells the IE rendering engine two things:
|
||||
|
||||
1. It should use the latest, or edge, version of the IE rendering environment
|
||||
2. If already installed, it should use the Google Chrome Frame rendering
|
||||
engine.
|
||||
|
||||
This `meta` tag ensures that anyone browsing your site in IE is treated to the
|
||||
best possible user experience that their browser can offer.
|
||||
|
||||
This line breaks validation, and the Google Chrome Frame part won't work inside
|
||||
a conditional comment. To avoid these edge case issues it is recommended that
|
||||
you **remove this line and use the `.htaccess`** (or other server config)
|
||||
to send these headers instead. You also might want to read [Validating:
|
||||
X-UA-Compatible](http://groups.google.com/group/html5boilerplate/browse_thread/thread/6d1b6b152aca8ed2).
|
||||
|
||||
If you are serving your site on a non-standard port, you will need to set this
|
||||
header on the server-side. This is because the IE preference option 'Display
|
||||
intranet sites in Compatibility View' is checked by default.
|
||||
|
||||
|
||||
## Mobile viewport
|
||||
|
||||
There are a few different options that you can use with the [`viewport` meta
|
||||
tag](https://docs.google.com/present/view?id=dkx3qtm_22dxsrgcf4 "Viewport and
|
||||
Media Queries - The Complete Idiot's Guide"). You can find out more in [the
|
||||
Apple developer docs](http://j.mp/mobileviewport). HTML5 Boilerplate comes with
|
||||
a simple setup that strikes a good balance for general use cases.
|
||||
|
||||
```html
|
||||
<meta name="viewport" content="width=device-width">
|
||||
```
|
||||
|
||||
## Favicons and Touch Icons
|
||||
|
||||
The shortcut icons should be put in the root directory of your site. HTML5
|
||||
Boilerplate comes with a default set of icons (include favicon and Apple Touch
|
||||
Icons) that you can use as a baseline to create your own.
|
||||
|
||||
If your site or icons are in a sub-directory, you will need to reference the
|
||||
icons using `link` elements placed in the HTML `head` of your document.
|
||||
|
||||
For a comprehensive overview, please read [Everything you always wanted to know
|
||||
about touch icons](http://mathiasbynens.be/notes/touch-icons) by Mathias
|
||||
Bynens.
|
||||
|
||||
|
||||
## Modernizr
|
||||
|
||||
HTML5 Boilerplate uses a custom build of Modernizr.
|
||||
|
||||
[Modernizr](http://modernizr.com) is a JavaScript library which adds classes to
|
||||
the `html` element based on the results of feature test and which ensures that
|
||||
all browsers can make use of HTML5 elements (as it includes the HTML5 Shiv).
|
||||
This allows you to target parts of your CSS and JavaScript based on the
|
||||
features supported by a browser.
|
||||
|
||||
In general, in order to keep page load times to a minimum, it's best to call
|
||||
any JavaScript at the end of the page because if a script is slow to load
|
||||
from an external server it may cause the whole page to hang. That said, the
|
||||
Modernizr script *needs* to run *before* the browser begins rendering the page,
|
||||
so that browsers lacking support for some of the new HTML5 elements are able to
|
||||
handle them properly. Therefore the Modernizr script is the only JavaScript
|
||||
file synchronously loaded at the top of the document.
|
||||
|
||||
|
||||
## The content area
|
||||
|
||||
The central part of the boilerplate template is pretty much empty. This is
|
||||
intentional, in order to make the boilerplate suitable for both web page and
|
||||
web app development.
|
||||
|
||||
### Google Chrome Frame
|
||||
|
||||
The main content area of the boilerplate includes a prompt to install Chrome
|
||||
Frame (which no longer requires administrative rights) for users of IE 6. If
|
||||
you intended to support IE 6, then you should remove the snippet of code.
|
||||
|
||||
### Google CDN for jQuery
|
||||
|
||||
The Google CDN version of the jQuery JavaScript library is referenced towards
|
||||
the bottom of the page using a protocol-independent path (read more about this
|
||||
in the [FAQ](faq.md). A local fallback of jQuery is included for rare instances
|
||||
when the CDN version might not be available, and to facilitate offline
|
||||
development.
|
||||
|
||||
Regardless of which JavaScript library you choose to use, it is well worth the
|
||||
time and effort to look up and reference the Google CDN (Content Delivery
|
||||
Network) version. Your users may already have this version cached in their
|
||||
browsers, and Google's CDN is likely to deliver the asset faster than your
|
||||
server.
|
||||
|
||||
### Google Analytics Tracking Code
|
||||
|
||||
Finally, an optimized version of the latest Google Analytics tracking code is
|
||||
included. Google recommends that this script be placed at the top of the page.
|
||||
Factors to consider: if you place this script at the top of the page, you’ll be
|
||||
able to count users who don’t fully load the page, and you’ll incur the max
|
||||
number of simultaneous connections of the browser.
|
||||
|
||||
Further information:
|
||||
|
||||
* [Optimizing the asynchronous Google Analytics
|
||||
snippet](http://mathiasbynens.be/notes/async-analytics-snippet).
|
||||
* [Tracking Site Activity - Google
|
||||
Analytics](http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html).
|
||||
31
doc/js.md
Normal file
@@ -0,0 +1,31 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# The JavaScript
|
||||
|
||||
Information about the default JavaScript included in the project.
|
||||
|
||||
## main.js
|
||||
|
||||
This file can be used to contain or reference your site/app JavaScript code.
|
||||
For larger projects, you can make use of a JavaScript module loader, like
|
||||
[Require.js](http://requirejs.org/), to load any other scripts you need to
|
||||
run.
|
||||
|
||||
## plugins.js
|
||||
|
||||
This file can be used to contain all your plugins, such as jQuery plugins and
|
||||
other 3rd party scripts.
|
||||
|
||||
One approach is to put jQuery plugins inside of a `(function($){ ...
|
||||
})(jQuery);` closure to make sure they're in the jQuery namespace safety
|
||||
blanket. Read more about [jQuery plugin
|
||||
authoring](http://docs.jquery.com/Plugins/Authoring#Getting_Started)
|
||||
|
||||
## vendor
|
||||
|
||||
This directory can be used to contain all 3rd party library code.
|
||||
|
||||
Minified versions of the latest jQuery and Modernizr libraries are included by
|
||||
default. You may wish to create your own [custom Modernizr
|
||||
build](http://www.modernizr.com/download/).
|
||||
25
doc/misc.md
Normal file
@@ -0,0 +1,25 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation table of contents](README.md)
|
||||
|
||||
# Miscellaneous
|
||||
|
||||
## .gitignore
|
||||
|
||||
HTML5 Boilerplate includes a basic project-level `.gitignore`. This should
|
||||
primarily be used to avoid certain project-level files and directories from
|
||||
being kept under source control. Different development-environments will
|
||||
benefit from different collections of ignores.
|
||||
|
||||
OS-specific and editor-specific files should be ignored using a "global
|
||||
ignore" that applies to all repositories on your system.
|
||||
|
||||
For example, add the following to your `~/.gitconfig`, where the `.gitignore`
|
||||
in your HOME directory contains the files and directories you'd like to
|
||||
globally ignore:
|
||||
|
||||
```gitignore
|
||||
[core]
|
||||
excludesfile = ~/.gitignore
|
||||
```
|
||||
|
||||
* More on global ignores: http://help.github.com/ignore-files/
|
||||
* Comprehensive set of ignores on GitHub: https://github.com/github/gitignore
|
||||
109
doc/usage.md
Normal file
@@ -0,0 +1,109 @@
|
||||
[HTML5 Boilerplate homepage](http://html5boilerplate.com) | [Documentation
|
||||
table of contents](README.md)
|
||||
|
||||
# Usage
|
||||
|
||||
Once you have cloned or downloaded HTML5 Boilerplate, creating a site or app
|
||||
usually involves the following:
|
||||
|
||||
1. Set up the basic structure of the site.
|
||||
2. Add some content, style, and functionality.
|
||||
3. Run your site locally to see how it looks.
|
||||
4. (Optionally run a build script to automate the optimization of your site -
|
||||
e.g. [ant build script](https://github.com/h5bp/ant-build-script) or [node
|
||||
build script](https://github.com/h5bp/node-build-script)).
|
||||
5. Deploy your site.
|
||||
|
||||
|
||||
## Basic structure
|
||||
|
||||
A basic HTML5 Boilerplate site initially looks something like this:
|
||||
|
||||
```
|
||||
.
|
||||
├── css
|
||||
│ ├── main.css
|
||||
│ └── normalize.css
|
||||
├── doc
|
||||
├── img
|
||||
├── js
|
||||
│ ├── main.js
|
||||
│ ├── plugins.js
|
||||
│ └── vendor
|
||||
│ ├── jquery.min.js
|
||||
│ └── modernizr.min.js
|
||||
├── .htaccess
|
||||
├── 404.html
|
||||
├── index.html
|
||||
├── humans.txt
|
||||
├── robots.txt
|
||||
├── crossdomain.xml
|
||||
├── favicon.ico
|
||||
└── [apple-touch-icons]
|
||||
```
|
||||
|
||||
What follows is a general overview of each major part and how to use them.
|
||||
|
||||
### css
|
||||
|
||||
This directory should contain all your project's CSS files. It includes some
|
||||
initial CSS to help get you started from a solid foundation. [About the
|
||||
CSS](css.md).
|
||||
|
||||
### doc
|
||||
|
||||
This directory contains all the HTML5 Boilerplate documentation. You can use it
|
||||
as the location and basis for your own project's documentation.
|
||||
|
||||
### js
|
||||
|
||||
This directory should contain all your project's JS files. Libraries, plugins,
|
||||
and custom code can all be included here. It includes some initial JS to help
|
||||
get you started. [About the JavaScript](js.md).
|
||||
|
||||
### .htaccess
|
||||
|
||||
The default web server config is for Apache. [About the .htaccess](htaccess.md).
|
||||
|
||||
Host your site on a server other than Apache? You're likely to find the
|
||||
corresponding configuration file in our [server configs
|
||||
repo](https://github.com/h5bp/server-configs). If you cannot find a
|
||||
configuration file for your setup, please consider contributing one so that
|
||||
others can benefit too.
|
||||
|
||||
### 404.html
|
||||
|
||||
A helpful custom 404 to get you started.
|
||||
|
||||
### index.html
|
||||
|
||||
This is the default HTML skeleton that should form the basis of all pages on
|
||||
your site. If you are using a server-side templating framework, then you will
|
||||
need to integrate this starting HTML with your setup.
|
||||
|
||||
Make sure that you update the URLs for the referenced CSS and JavaScript if you
|
||||
modify the directory structure at all.
|
||||
|
||||
If you are using Google Analytics, make sure that you edit the corresponding
|
||||
snippet at the bottom to include your analytics ID.
|
||||
|
||||
### humans.txt
|
||||
|
||||
Edit this file to include the team that worked on your site/app, and the
|
||||
technology powering it.
|
||||
|
||||
### robots.txt
|
||||
|
||||
Edit this file to include any pages you need hidden from search engines.
|
||||
|
||||
### crossdomain.xml
|
||||
|
||||
A template for working with cross-domain requests. [About
|
||||
crossdomain.xml](crossdomain.md).
|
||||
|
||||
### icons
|
||||
|
||||
Replace the default `favicon.ico` and apple touch icons with your own. You
|
||||
might want to check out Hans Christian's handy [HTML5 Boilerplate Favicon and
|
||||
Apple Touch Icon
|
||||
PSD-Template](http://drublic.de/blog/html5-boilerplate-favicons-psd-template/).
|
||||
BIN
favicon.ico
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 318 B |
48
humans.txt
@@ -1,43 +1,15 @@
|
||||
/* the humans responsible & colophon */
|
||||
/* humanstxt.org */
|
||||
# humanstxt.org/
|
||||
# The humans responsible & technology colophon
|
||||
|
||||
# TEAM
|
||||
|
||||
/* TEAM */
|
||||
<your title>: <your name>
|
||||
Site:
|
||||
Twitter:
|
||||
Location:
|
||||
<name> -- <role> -- <twitter>
|
||||
|
||||
/* THANKS */
|
||||
Names (& URL):
|
||||
# THANKS
|
||||
|
||||
/* SITE */
|
||||
Standards: HTML5, CSS3
|
||||
Components: Modernizr, jQuery
|
||||
Software:
|
||||
|
||||
<name>
|
||||
|
||||
|
||||
-o/-
|
||||
+oo//-
|
||||
:ooo+//:
|
||||
-ooooo///-
|
||||
/oooooo//:
|
||||
:ooooooo+//-
|
||||
-+oooooooo///-
|
||||
-://////////////+oooooooooo++////////////::
|
||||
:+ooooooooooooooooooooooooooooooooooooo+:::-
|
||||
-/+ooooooooooooooooooooooooooooooo+/::////:-
|
||||
-:+oooooooooooooooooooooooooooo/::///////:-
|
||||
--/+ooooooooooooooooooooo+::://////:-
|
||||
-:+ooooooooooooooooo+:://////:--
|
||||
/ooooooooooooooooo+//////:-
|
||||
-ooooooooooooooooooo////-
|
||||
/ooooooooo+oooooooooo//:
|
||||
:ooooooo+/::/+oooooooo+//-
|
||||
-oooooo/::///////+oooooo///-
|
||||
/ooo+::://////:---:/+oooo//:
|
||||
-o+/::///////:- -:/+o+//-
|
||||
:-:///////:- -:/://
|
||||
-////:- --//:
|
||||
-- -:
|
||||
# TECHNOLOGY COLOPHON
|
||||
|
||||
HTML5, CSS3
|
||||
jQuery, Modernizr
|
||||
|
||||
2
img/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
!.gitignore
|
||||
|
||||
|
||||
110
index.html
@@ -1,80 +1,40 @@
|
||||
<!doctype html>
|
||||
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
|
||||
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
|
||||
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
|
||||
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
|
||||
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<!DOCTYPE html>
|
||||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
||||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title></title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
||||
Remove this if you use the .htaccess -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
|
||||
|
||||
<title></title>
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<link rel="stylesheet" href="css/normalize.css">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<script src="js/vendor/modernizr-2.6.1.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!--[if lt IE 7]>
|
||||
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
|
||||
<![endif]-->
|
||||
|
||||
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Add your site or application content here -->
|
||||
<p>Hello world! This is HTML5 Boilerplate.</p>
|
||||
|
||||
<!-- Place favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
|
||||
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.0.min.js"><\/script>')</script>
|
||||
<script src="js/plugins.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
|
||||
|
||||
<!-- CSS: implied media="all" -->
|
||||
<link rel="stylesheet" href="css/style.css?v=2">
|
||||
|
||||
<!-- Uncomment if you are specifically targeting less enabled mobile browsers
|
||||
<link rel="stylesheet" media="handheld" href="css/handheld.css?v=2"> -->
|
||||
|
||||
<!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
|
||||
<script src="js/libs/modernizr-1.7.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
<header>
|
||||
|
||||
</header>
|
||||
<div id="main" role="main">
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
</footer>
|
||||
</div> <!--! end of #container -->
|
||||
|
||||
|
||||
<!-- JavaScript at the bottom for fast page loading -->
|
||||
|
||||
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
|
||||
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.5.1.min.js">\x3C/script>')</script>
|
||||
|
||||
|
||||
<!-- scripts concatenated and minified via ant build script-->
|
||||
<script src="js/plugins.js"></script>
|
||||
<script src="js/script.js"></script>
|
||||
<!-- end scripts-->
|
||||
|
||||
|
||||
<!--[if lt IE 7 ]>
|
||||
<script src="js/libs/dd_belatedpng.js"></script>
|
||||
<script>DD_belatedPNG.fix('img, .png_bg'); // Fix any <img> or .png_bg bg-images. Also, please read goo.gl/mZiyb </script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
<!-- mathiasbynens.be/notes/async-analytics-snippet Change UA-XXXXX-X to be your site's ID -->
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
|
||||
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
||||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
||||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
8316
js/libs/jquery-1.5.1.js
vendored
16
js/libs/jquery-1.5.1.min.js
vendored
2
js/libs/modernizr-1.7.min.js
vendored
1
js/main.js
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
2
js/mylibs/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
!.gitignore
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
// Avoid `console` errors in browsers that lack a console.
|
||||
if (!(window.console && console.log)) {
|
||||
(function() {
|
||||
var noop = function() {};
|
||||
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'markTimeline', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
|
||||
var length = methods.length;
|
||||
var console = window.console = {};
|
||||
while (length--) {
|
||||
console[methods[length]] = noop;
|
||||
}
|
||||
}());
|
||||
}
|
||||
|
||||
// usage: log('inside coolFunc', this, arguments);
|
||||
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
|
||||
window.log = function(){
|
||||
log.history = log.history || []; // store logs to an array for reference
|
||||
log.history.push(arguments);
|
||||
arguments.callee = arguments.callee.caller;
|
||||
if(this.console) console.log( Array.prototype.slice.call(arguments) );
|
||||
};
|
||||
// make it safe to use console.log always
|
||||
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});
|
||||
|
||||
|
||||
// place any jQuery/helper plugins in here, instead of separate, slower script files.
|
||||
|
||||
// Place any jQuery/helper plugins in here.
|
||||
|
||||
26
js/script.js
@@ -1,26 +0,0 @@
|
||||
/* Author:
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2
js/vendor/jquery-1.8.0.min.js
vendored
Normal file
4
js/vendor/modernizr-2.6.1.min.js
vendored
Normal file
@@ -1,5 +1,3 @@
|
||||
# www.robotstxt.org/
|
||||
# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
|
||||
# robotstxt.org/
|
||||
|
||||
User-agent: *
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>QUnit Tests</title>
|
||||
<link rel="stylesheet" href="qunit/qunit.css" media="screen">
|
||||
|
||||
<!-- reference your own javascript files here -->
|
||||
|
||||
<script src="../js/libs/modernizr-1.7.min.js"></script>
|
||||
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
|
||||
<script src="../js/plugins.js"></script>
|
||||
<script src="../js/script.js"></script>
|
||||
|
||||
|
||||
<!-- test runner files -->
|
||||
<script src="qunit/qunit.js"></script>
|
||||
<script src="tests.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="flora">
|
||||
<h1 id="qunit-header">QUnit Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,148 +0,0 @@
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
||||
#qunit-tests { font-size: smaller; }
|
||||
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-tests li ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px;
|
||||
background-color: #0d3349;
|
||||
|
||||
border-radius: 15px 15px 0 0;
|
||||
-moz-border-radius: 15px 15px 0 0;
|
||||
-webkit-border-top-right-radius: 15px;
|
||||
-webkit-border-top-left-radius: 15px;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0em 0 0.5em 2em;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 0 0.5em 2.5em;
|
||||
background-color: #2b81af;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
||||
border-bottom: 1px solid #fff;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests li ol {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #fff;
|
||||
|
||||
border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
|
||||
box-shadow: inset 0px 2px 13px #999;
|
||||
-moz-box-shadow: inset 0px 2px 13px #999;
|
||||
-webkit-box-shadow: inset 0px 2px 13px #999;
|
||||
}
|
||||
|
||||
#qunit-tests li li {
|
||||
margin: 0.5em;
|
||||
padding: 0.4em 0.5em 0.4em 0.5em;
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #5E740B;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests li.pass { color: #528CE0; background-color: #D2E0E6; }
|
||||
#qunit-tests li.pass span.test-name { color: #366097; }
|
||||
|
||||
#qunit-tests li li.pass span.test-actual,
|
||||
#qunit-tests li li.pass span.test-expected { color: #999999; }
|
||||
|
||||
strong b.pass { color: #5E740B; }
|
||||
|
||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #EE5757;
|
||||
}
|
||||
|
||||
#qunit-tests li.fail { color: #000000; background-color: #EE5757; }
|
||||
#qunit-tests li.fail span.test-name,
|
||||
#qunit-tests li.fail span.module-name { color: #000000; }
|
||||
|
||||
#qunit-tests li li.fail span.test-actual { color: #EE5757; }
|
||||
#qunit-tests li li.fail span.test-expected { color: green; }
|
||||
|
||||
strong b.fail { color: #710909; }
|
||||
|
||||
#qunit-banner.qunit-fail,
|
||||
#qunit-testrunner-toolbar { background-color: #EE5757; }
|
||||
|
||||
|
||||
/** Footer */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
||||
|
||||
color: #2b81af;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-radius: 0 0 15px 15px;
|
||||
-moz-border-radius: 0 0 15px 15px;
|
||||
-webkit-border-bottom-right-radius: 15px;
|
||||
-webkit-border-bottom-left-radius: 15px;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
}
|
||||
1265
test/qunit/qunit.js
@@ -1,27 +0,0 @@
|
||||
|
||||
// documentation on writing tests here: http://docs.jquery.com/QUnit
|
||||
// example tests: https://github.com/jquery/qunit/blob/master/test/same.js
|
||||
|
||||
// below are some general tests but feel free to delete them.
|
||||
|
||||
module("example tests");
|
||||
test('HTML5 Boilerplate is sweet',function(){
|
||||
expect(1);
|
||||
equals('boilerplate'.replace('boilerplate','sweet'),'sweet','Yes. HTML5 Boilerplate is, in fact, sweet');
|
||||
|
||||
})
|
||||
|
||||
// these test things from plugins.js
|
||||
test('Environment is good',function(){
|
||||
expect(3);
|
||||
ok( !!window.log, 'log function present');
|
||||
|
||||
var history = log.history && log.history.length || 0;
|
||||
log('logging from the test suite.')
|
||||
equals( log.history.length - history, 1, 'log history keeps track' )
|
||||
|
||||
ok( !!window.Modernizr, 'Modernizr global is present')
|
||||
})
|
||||
|
||||
|
||||
|
||||