[dpdk-web] [PATCH] use cached fonts

Thomas Monjalon thomas.monjalon at 6wind.com
Thu May 26 12:40:48 CEST 2016


Accelerate page loading by downloading fonts from the CDN.

Note that it is a cross-domain resource request (CORS).
It is solved by adding the following header when serving fonts:
	Access-Control-Allow-Origin *
---
 fonts.css | 60 ++++++++++++++++++++++++++++++------------------------------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/fonts.css b/fonts.css
index 7a2ba0d..2260dfd 100644
--- a/fonts.css
+++ b/fonts.css
@@ -1,61 +1,61 @@
 @font-face {
 	font-family: 'opensans';
-	src: url('/fonts/opensans-regular.eot');
-	src: url('/fonts/opensans-regular.eot?#iefix') format('embedded-opentype'),
-	     url('/fonts/opensans-regular.woff') format('woff'),
-	     url('/fonts/opensans-regular.ttf') format('truetype'),
-	     url('/fonts/opensans-regular.svg#open_sansregular') format('svg');
+	src: url('http://fast.dpdk.org/fonts/opensans-regular.eot');
+	src: url('http://fast.dpdk.org/fonts/opensans-regular.eot?#iefix') format('embedded-opentype'),
+	     url('http://fast.dpdk.org/fonts/opensans-regular.woff') format('woff'),
+	     url('http://fast.dpdk.org/fonts/opensans-regular.ttf') format('truetype'),
+	     url('http://fast.dpdk.org/fonts/opensans-regular.svg#open_sansregular') format('svg');
 	font-weight: normal;
 	font-style: normal;
 }
 @font-face {
 	font-family: 'opensans';
-	src: url('/fonts/opensans-semibold.eot');
-	src: url('/fonts/opensans-semibold.eot?#iefix') format('embedded-opentype'),
-	     url('/fonts/opensans-semibold.woff') format('woff'),
-	     url('/fonts/opensans-semibold.ttf') format('truetype'),
-	     url('/fonts/opensans-semibold.svg#open_sanssemibold') format('svg');
+	src: url('http://fast.dpdk.org/fonts/opensans-semibold.eot');
+	src: url('http://fast.dpdk.org/fonts/opensans-semibold.eot?#iefix') format('embedded-opentype'),
+	     url('http://fast.dpdk.org/fonts/opensans-semibold.woff') format('woff'),
+	     url('http://fast.dpdk.org/fonts/opensans-semibold.ttf') format('truetype'),
+	     url('http://fast.dpdk.org/fonts/opensans-semibold.svg#open_sanssemibold') format('svg');
 	font-weight: bold;
 	font-style: normal;
 }
 @font-face {
 	font-family: 'opensans';
-	src: url('/fonts/opensans-italic.eot');
-	src: url('/fonts/opensans-italic.eot?#iefix') format('embedded-opentype'),
-	     url('/fonts/opensans-italic.woff') format('woff'),
-	     url('/fonts/opensans-italic.ttf') format('truetype'),
-	     url('/fonts/opensans-italic.svg#open_sansitalic') format('svg');
+	src: url('http://fast.dpdk.org/fonts/opensans-italic.eot');
+	src: url('http://fast.dpdk.org/fonts/opensans-italic.eot?#iefix') format('embedded-opentype'),
+	     url('http://fast.dpdk.org/fonts/opensans-italic.woff') format('woff'),
+	     url('http://fast.dpdk.org/fonts/opensans-italic.ttf') format('truetype'),
+	     url('http://fast.dpdk.org/fonts/opensans-italic.svg#open_sansitalic') format('svg');
 	font-weight: normal;
 	font-style: italic;
 }
 
 @font-face {
 	font-family: 'exo2';
-	src: url('/fonts/exo2-regular.eot');
-	src: url('/fonts/exo2-regular.eot?#iefix') format('embedded-opentype'),
-	     url('/fonts/exo2-regular.woff') format('woff'),
-	     url('/fonts/exo2-regular.ttf') format('truetype'),
-	     url('/fonts/exo2-regular.svg#exo_2.0regular') format('svg');
+	src: url('http://fast.dpdk.org/fonts/exo2-regular.eot');
+	src: url('http://fast.dpdk.org/fonts/exo2-regular.eot?#iefix') format('embedded-opentype'),
+	     url('http://fast.dpdk.org/fonts/exo2-regular.woff') format('woff'),
+	     url('http://fast.dpdk.org/fonts/exo2-regular.ttf') format('truetype'),
+	     url('http://fast.dpdk.org/fonts/exo2-regular.svg#exo_2.0regular') format('svg');
 	font-weight: normal;
 	font-style: normal;
 }
 @font-face {
 	font-family: 'exo2';
-	src: url('/fonts/exo2-bold.eot');
-	src: url('/fonts/exo2-bold.eot?#iefix') format('embedded-opentype'),
-	     url('/fonts/exo2-bold.woff') format('woff'),
-	     url('/fonts/exo2-bold.ttf') format('truetype'),
-	     url('/fonts/exo2-bold.svg#exo_2.0bold') format('svg');
+	src: url('http://fast.dpdk.org/fonts/exo2-bold.eot');
+	src: url('http://fast.dpdk.org/fonts/exo2-bold.eot?#iefix') format('embedded-opentype'),
+	     url('http://fast.dpdk.org/fonts/exo2-bold.woff') format('woff'),
+	     url('http://fast.dpdk.org/fonts/exo2-bold.ttf') format('truetype'),
+	     url('http://fast.dpdk.org/fonts/exo2-bold.svg#exo_2.0bold') format('svg');
 	font-weight: bold;
 	font-style: normal;
 }
 @font-face {
 	font-family: 'exo2';
-	src: url('/fonts/exo2-blackitalic.eot');
-	src: url('/fonts/exo2-blackitalic.eot?#iefix') format('embedded-opentype'),
-	     url('/fonts/exo2-blackitalic.woff') format('woff'),
-	     url('/fonts/exo2-blackitalic.ttf') format('truetype'),
-	     url('/fonts/exo2-blackitalic.svg#exo_2.0black_italic') format('svg');
+	src: url('http://fast.dpdk.org/fonts/exo2-blackitalic.eot');
+	src: url('http://fast.dpdk.org/fonts/exo2-blackitalic.eot?#iefix') format('embedded-opentype'),
+	     url('http://fast.dpdk.org/fonts/exo2-blackitalic.woff') format('woff'),
+	     url('http://fast.dpdk.org/fonts/exo2-blackitalic.ttf') format('truetype'),
+	     url('http://fast.dpdk.org/fonts/exo2-blackitalic.svg#exo_2.0black_italic') format('svg');
 	font-weight: bold;
 	font-style: italic;
 }
-- 
2.7.0



More information about the web mailing list