From d8446d0b90f79cd47bb01d900057b08c5f683fa6 Mon Sep 17 00:00:00 2001 From: khlieng Date: Mon, 16 Feb 2015 21:53:01 +0100 Subject: [PATCH] Fontello icon font --- client/gulpfile.js | 17 +++++--- client/src/css/fontello.css | 54 ++++++++++++++++++++++++ client/src/{ => css}/style.css | 4 ++ client/src/font/fontello.eot | Bin 0 -> 5288 bytes client/src/font/fontello.svg | 13 ++++++ client/src/font/fontello.ttf | Bin 0 -> 5120 bytes client/src/font/fontello.woff | Bin 0 -> 2912 bytes client/src/index.html | 4 +- client/src/js/components/Connect.jsx | 2 +- client/src/js/components/MessageBox.jsx | 1 - client/src/js/components/TabList.jsx | 2 +- main.go | 38 ++++++++++++++--- 12 files changed, 117 insertions(+), 18 deletions(-) create mode 100644 client/src/css/fontello.css rename client/src/{ => css}/style.css (98%) create mode 100644 client/src/font/fontello.eot create mode 100644 client/src/font/fontello.svg create mode 100644 client/src/font/fontello.ttf create mode 100644 client/src/font/fontello.woff diff --git a/client/gulpfile.js b/client/gulpfile.js index cb4ff435..23d654dc 100644 --- a/client/gulpfile.js +++ b/client/gulpfile.js @@ -27,10 +27,10 @@ gulp.task('html', function() { }); gulp.task('css', function() { - gulp.src('./src/*.css') + gulp.src('./src/css/*.css') .pipe(autoprefixer()) .pipe(minifyCSS()) - .pipe(gulp.dest('./dist')); + .pipe(gulp.dest('./dist/css')); }); gulp.task('js', function() { @@ -70,14 +70,19 @@ function js(watch) { return rebundle(); } -gulp.task('gzip', ['html', 'css', 'js'], function() { - gulp.src('./dist/*.{html,css,js}') +gulp.task('fonts', function() { + gulp.src('./src/font/*') + .pipe(gulp.dest('./dist/font')); +}); + +gulp.task('gzip', ['html', 'css', 'js', 'fonts'], function() { + gulp.src('./dist/**/!(*.gz)') .pipe(gzip()) .pipe(gulp.dest('./dist')); }); gulp.task('gzip:watch', function() { - gulp.src('./dist/*.{html,css,js}') + gulp.src('./dist/**/*.{html,css,js}') .pipe(gzip()) .pipe(gulp.dest('./dist')); }); @@ -89,4 +94,4 @@ gulp.task('watch', ['default'], function() { return js(true); }); -gulp.task('default', ['html', 'css', 'js', 'gzip']); \ No newline at end of file +gulp.task('default', ['html', 'css', 'js', 'fonts', 'gzip']); \ No newline at end of file diff --git a/client/src/css/fontello.css b/client/src/css/fontello.css new file mode 100644 index 00000000..4140939a --- /dev/null +++ b/client/src/css/fontello.css @@ -0,0 +1,54 @@ +@font-face { + font-family: 'fontello'; + src: url('../font/fontello.eot?73444496'); + src: url('../font/fontello.eot?73444496#iefix') format('embedded-opentype'), + url('../font/fontello.woff?73444496') format('woff'), + url('../font/fontello.ttf?73444496') format('truetype'), + url('../font/fontello.svg?73444496#fontello') format('svg'); + font-weight: normal; + font-style: normal; +} +/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */ +/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */ +/* +@media screen and (-webkit-min-device-pixel-ratio:0) { + @font-face { + font-family: 'fontello'; + src: url('../font/fontello.svg?73444496#fontello') format('svg'); + } +} +*/ + + [class^="icon-"]:before, [class*=" icon-"]:before { + font-family: "fontello"; + font-style: normal; + font-weight: normal; + speak: none; + + display: inline-block; + text-decoration: inherit; + width: 1em; + margin-right: .2em; + text-align: center; + /* opacity: .8; */ + + /* For safety - reset parent styles, that can break glyph codes*/ + font-variant: normal; + text-transform: none; + + /* fix buttons height, for twitter bootstrap */ + line-height: 1em; + + /* Animation center compensation - margins should be symmetric */ + /* remove if not needed */ + margin-left: .2em; + + /* you can be more comfortable with increased icons size */ + /* font-size: 120%; */ + + /* Uncomment for 3D effect */ + /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ +} + +.icon-cog:before { content: '\e800'; } /* '' */ +.icon-ellipsis:before { content: '\e801'; } /* '' */ \ No newline at end of file diff --git a/client/src/style.css b/client/src/css/style.css similarity index 98% rename from client/src/style.css rename to client/src/css/style.css index a7dfdcaa..0147b7ac 100644 --- a/client/src/style.css +++ b/client/src/css/style.css @@ -26,6 +26,10 @@ p { line-height: 1.5; } +i[class^="icon-"]:before, i[class*=" icon-"]:before { + margin: 0; +} + .tablist { position: fixed; left: 0; diff --git a/client/src/font/fontello.eot b/client/src/font/fontello.eot new file mode 100644 index 0000000000000000000000000000000000000000..e982f2208f62f2fdcef470b768c21ce8ee017266 GIT binary patch literal 5288 zcmd^DO>7&-6`tYpPoyL=mPEy-A`i8eEQ?F($JS45*_KIBaxA;1WLf1pO|mPB`mrUE zk!ZtibI74V9ilCa9(pT~9tz|*t2D?@d&r@O6lj6;67OE$_p|s*(Eo!ueqSkXSO0b`f0?ns=V%|T zY?Ug1x~IIuSj+dJe~)qHP5y-WSkUub&#z(mp(FWU*dWI??e7uV4t(;Gk^}`KCbN#_Ayba= zf3gTW$@*F7BTemSX;hR{vIU_#t#o%Sy~+wZk^auK^16Z|Dd zIHr@f;#fYS)@PYVU}QC&2K>TTK7IF%$oRimSb0jh{)fQv4qN*Fg_`5;JQWb9Y}$R? zGY9_eu5xGp#85wc6dFlE6;fVs40g?+`4kjEr|QyZQ4~d-$S~C?`W$0_-WzKeI`yDu zkPW-o!vgH0ixt=>UF-$E?qVMcvw0W$VSmHLA(lj8cE${|7WNaW2;K(FaF_kU#hgWX z#Kj)g%ul*lfj#A7FYrYd`&f+MaIqiuqKiXpfp5Dw%zF55v*pU8t+kcas_4z05kmum z!(#D~D8sb2X|4Y36Ou6HV%2xSqsaQ>~R;!is{r&ZxG#|_2hN`ef zxUJR@s#V-<0>v`R&Oi>~&Kkr<2(}1@0MlWu;RZBu+X+1HqsOY3iVcyg zsU~fN9Vr&4Xi5=>lXWkp(yf}4&J^LV=q^v87dr1P?b%L^lrw5(Cmd38g+yFU=zWQl zY|<=`CnuN8$&_r?umB-sWA+-Y3qZ~2vWc`gXid;kGJ;{Ec1Q#wP=wpEIctcTA!IXx zmXc9zX1-u~mnQX7vZQyF2@lC**a@XOU$7{15v)uN+e_2-B~)~)8f zFQO_!jBL8J!#TIJp+#dB^W^3WGNNWgPKJ?`A?%xx5eBCJFdF4}KhI=phIP!Jlv~Mo z7sAwvwY4NuvQ4u%$r$2HvR$(jk}qnOm*jEH@{v5DS$>jn%?gn0(5xWImo%$^WT(bt zQ}P=)auSYoVgLb0NG9M2$u2lTQiUTVPr(tA-Ef3t4;&$R8jg_cg(D=-Xky&X^F9sh zj~XJ2O)zNFOh|c#k}9dmzNGBKanX>e(@3c!&x>k~sZ^`}Cj+j$R1P-vYhu{;a{wHkd;Ykh3LNPc*;(wDcDfqrybUWE#Jb_=kzEXAtvQyG zLt46hJSES59Tgc?1pOSgg2lQ;T1?Z)LHRDuF(HfkP@>sij*S~34HN=OXZ zkAF5rHe{2fT3QuiyoRwx_M1i88AEz8CRjombeJb*3m@#c!X;E)b;=xztC(R5>w>Un z!FWeZ0!OG4dU3iDdmj=Bb^DMf7|}%MZrcewag9(3+n)}y0tI?6Q|s&f z`c#}gDlxuE_EFrZu8gZ=@x(LxozPt$GZc(^P_wlD1Vx@)bl0)B#4sPWs)*jlFF(4L%M2G3@_QA&*24x{}@Htd9AKk%$LCnL!Tpq2PFLuU4w0L zk-{deQ~dEPUKSr0EM;lZ>LKmZ;M@3{bK-FkZ%m-zomjV6W8cSo_Z{i|5pIV`_Fq@0 Bm#hE) literal 0 HcmV?d00001 diff --git a/client/src/font/fontello.svg b/client/src/font/fontello.svg new file mode 100644 index 00000000..b947f26e --- /dev/null +++ b/client/src/font/fontello.svg @@ -0,0 +1,13 @@ + + + +Copyright (C) 2015 by original authors @ fontello.com + + + + + + + + + \ No newline at end of file diff --git a/client/src/font/fontello.ttf b/client/src/font/fontello.ttf new file mode 100644 index 0000000000000000000000000000000000000000..7f7297f8f5819405a088df128a49bf4ca02c0369 GIT binary patch literal 5120 zcmd^DO>7&-6`tYpXGKb)Vo6kND)LZk$+EblWZL?PE!zrzB*%(tN|sfw(7hW6vr2>fw1*seNP!keFF`LY+MA31+zRxjes8&yEL&-S zTuYn#zW3&vnKy6Vdt94w##lRhhbhdwadRYf>91Em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5X(45f-C_5#2y6i??wyWA%5rJUAtL`a6B`SDVB&twK)L@@B*dCbRS&v z27SP!O@|-b;z1b^wBnx%vAxPWEU|=zbEMS|nbCb@?t7%9xb~79mMFX2+KGyDuXfMp z-K)w>?yqy(n5xSH)VtL9Rc$i{V+Cl!-nG$sn(7L}7d0x9^Tj0!XtrI}Kh(O;Pf7Ya zb{*5U)3v6Fn0;Heo5SU4D9q_QVHAdEFcrxX;9qjJNxkAdD~%%jbn3eJ*vhlYFLDp` zU!-A=uo~q-ww-cAR>q4@<`uol%oMb;mil8oN}F^BYcyex3|4ZyYsC!hC{Yzkdy1(sQ8+zz`>_VVt^A+p#XJ z@>P3MEH18W%4+uPO1nlLVP|V46Q52+5v`b)`S#kHTlUoq)Z<$9Dl&*{ggdIT)UlWovNOYJfHQq#QE*>$b# z#-qJviCI##**|AVyaOme*Y0Fdsr0+_EDYvip453+*;fVXuQI7j0Lq<(@z0rW{`tmF z@-$IO%H`T8XlI@nObpg@OjN`!PgM!+uItXtA0i8ZKxCB?vfhv%akv=b+o5r^`1}1R w1%mM1wWVn0``*khyVZp literal 0 HcmV?d00001 diff --git a/client/src/index.html b/client/src/index.html index 94c57f0a..7faca1bb 100644 --- a/client/src/index.html +++ b/client/src/index.html @@ -7,8 +7,8 @@ IRC - - + + diff --git a/client/src/js/components/Connect.jsx b/client/src/js/components/Connect.jsx index 257e2f10..d4b0344e 100644 --- a/client/src/js/components/Connect.jsx +++ b/client/src/js/components/Connect.jsx @@ -65,7 +65,7 @@ var Connect = React.createClass({ {optionals}

- +

diff --git a/client/src/js/components/MessageBox.jsx b/client/src/js/components/MessageBox.jsx index 99577be8..115998a9 100644 --- a/client/src/js/components/MessageBox.jsx +++ b/client/src/js/components/MessageBox.jsx @@ -4,7 +4,6 @@ var _ = require('lodash'); var Infinite = require('react-infinite'); var util = require('../util'); -var messageStore = require('../stores/message'); var messageLineStore = require('../stores/messageLine'); var selectedTabStore = require('../stores/selectedTab'); var messageActions = require('../actions/message'); diff --git a/client/src/js/components/TabList.jsx b/client/src/js/components/TabList.jsx index 45b00381..86b30771 100644 --- a/client/src/js/components/TabList.jsx +++ b/client/src/js/components/TabList.jsx @@ -71,7 +71,7 @@ var TabList = React.createClass({ {tabs}
- +
); diff --git a/main.go b/main.go index 962bb97a..81b595f6 100644 --- a/main.go +++ b/main.go @@ -17,8 +17,14 @@ var ( sessions map[string]*Session sessionLock sync.Mutex fs http.Handler + files []File ) +type File struct { + Path string + ContentType string +} + func reconnect() { for _, user := range storage.LoadUsers() { channels := user.GetChannels() @@ -62,17 +68,25 @@ func serveFiles(w http.ResponseWriter, r *http.Request) { ext = ".gz" } - if strings.HasSuffix(r.URL.Path, "bundle.js") { - w.Header().Set("Content-Type", "text/javascript") - r.URL.Path = "/bundle.js" + ext - } else if strings.HasSuffix(r.URL.Path, "style.css") { - w.Header().Set("Content-Type", "text/css") - r.URL.Path = "/style.css" + ext - } else { + if r.URL.Path == "/" { w.Header().Set("Content-Type", "text/html") r.URL.Path = "/index.html" + ext + fs.ServeHTTP(w, r) + return } + for _, file := range files { + if strings.HasSuffix(r.URL.Path, file.Path) { + w.Header().Set("Content-Type", file.ContentType) + r.URL.Path = file.Path + ext + fs.ServeHTTP(w, r) + return + } + } + + w.Header().Set("Content-Type", "text/html") + r.URL.Path = "/index.html" + ext + fs.ServeHTTP(w, r) } @@ -83,6 +97,16 @@ func main() { sessions = make(map[string]*Session) fs = http.FileServer(http.Dir("client/dist")) + files = []File{ + File{"/bundle.js", "text/javascript"}, + File{"/css/style.css", "text/css"}, + File{"/css/fontello.css", "text/css"}, + File{"/font/fontello.eot", "application/vnd.ms-fontobject"}, + File{"/font/fontello.svg", "image/svg+xml"}, + File{"/font/fontello.ttf", "application/x-font-ttf"}, + File{"/font/fontello.woff", "application/font-woff"}, + } + //reconnect() router := httprouter.New()