At the end of my last post about Grunt I mentioned that I will be adding code to concatenate the javascript, compress the images and also tidy the code up abit. I have now done this ….

Javascript

I moved all of the javascript to a folder called _js and then set up the following ….

More Grunt & Jekyll 1/7
jssβ€˜]d}:r_,ecjs{:st/:[jqβ€˜ujesr/ym.amiinn..jjss’’,β€˜_js/jquery.plugin.min.js’,β€˜js/bootstrap.min.js’,β€˜_js/jquery.flexslider-min.js’,β€˜_js/smooth-scroll.min.js’,’_js/skrollr.min.js’,β€˜_js/twitterFetcher_v10_min.js’,β€˜_js/spectragram.min.js’,β€˜_js/scrollReveal.min.js’,β€˜_js/isotope.min.js’,β€˜_js/lightbox.min.js’,β€˜_js/jquery.countdown.min.js’,β€˜_js/scripts.js’

As you can see I am having to merge the javascript in a certain order, I tried using src: [β€˜_js/*’] but this broke a lot of the site.

Now I have all of the javascript in a single file which works I can compress it using Uglifyβ†—  ….

More Grunt & Jekyll 2/7
u}gob}mfβ€˜}},lpa,yijitn_lsfinte/yoeasm:nrr:as:gi{:e{nβ€˜t.{/:m*i!{n.<j%s=’:pk[gβ€˜.jnsa/mmeai%n>.j<s%’=]grunt.template.today(β€œdd-mm-yyyy”)%>\n’

I then created a task to put it all together ….

More Grunt & Jekyll 3/7
grunt.registerTask(β€˜js’,[β€˜concat:js’,β€˜uglify’]);

as well as adding the _js and tasks to the watch section of my Gruntfile.js.

Images

I use the TinyPNGβ†— Photoshop plug-in to export the headers and other images so most of the graphics on the site are already quite compressed, however to ensure that everything is as optimised as possible I added the following ….

More Grunt & Jekyll 4/7
i}s}}mdoop}fecsd}},vdfecsd},gippr,ixwre]giixwre]csttolpdcsmslpdcsotiigea::titea::tm:omrsn:n:sn:pnie:dβ€˜β€˜::dβ€˜β€˜r{szs:i{β€˜{:i{β€˜e:as[m,i{[m,isti{tgm{tgms{ivr/gr/g:oeu’}u’}n:e,’e,’{L,.,.et{svrpveungleg’:,,j7p,g,jpeg}’,

as the site has a lot of image files Newerβ†— was used to files are only processed if they have been changed or haven’t been processed. I added the following task ….

More Grunt & Jekyll 5/7
grunt.registerTask(β€˜images’,[β€˜newer:imgcompress’,β€˜newer:svgmin’]);

However, for the moment I have left it out of the watch list as it can take a little while to execute.

Full files

This now means my Gruntfile.js looks like ….

More Grunt & Jekyll 6/7
ml}s}}w}c}}rggggg}ogpedocyo}fβ€œ}}}ccsβ€˜]d}jsβ€˜]d}}ccsd}}uob}mfβ€˜}}}jos}dodc}}}idoop}fecsd}},vdfecsd},aol}cft}jft}hftos}},osopb}},)errrrr;drksepoup,i_,osr_,e,sr_,e,ssre,gpa,yij,epr,ipeo,mippr,ixwre]giixwre]tpi,sia,sia,tiappnepoa;quuuuuuugsvtmitlcnsccs:cjssscsltn_lsktcstsngsttolpdcsmslpdcsctvsls:lsmlstanrtrsunnnnnln::eipciesc::st:stm::tiinte/yi:titfctiigea::titea::thie:ekeklekiweviteitttttetloromssas:{/:i:foeasmlo:o:io:omrsn:n:sn::orss{ss:ssonceo::r.......g{onemi:/t{[/[jn{β€˜ynrr:alnβ€˜ngmnie:dβ€˜β€˜::dβ€˜β€˜ne{::::::n:trnerrrrreirpsspzm:*β€˜qβ€˜:cβ€˜:s:gi:s.{sβ€˜:p{szs:i{β€˜{:i{β€˜{sl{s::s8β€˜(eeeeexnum:sra{a’cujsc:e{n:’:.r:as[m,i{[m,i:o[[[[[[:f:0.β€˜gggggpine:eti{ses{ss{β€˜t.{/β€˜eti{tgm{tgmaβ€˜β€˜β€˜β€˜β€˜β€˜a{{0/liiiiiottn{sinsr//s{/:m{{__s{ivr/gr/g{d_l_c*j{l{0_osssssrC.ttso./ymm/*iscsoeu’}u’}:cejo.es,sattttttof:r:ncm.aam!{nio:n:e,’e,’sssnhkeideeeeesniu:samiia.tnL,.,.tss/cty,t-rrrrrfl{etsiinni<jef{et{sr/’*amlegTTTTT=ie,r2”nn..n%s’ivrpvu*,’tll’raaaaag.u:..jc.=’,geunge’]:’’usssssf(recjssm:-leg’,,β€˜,j,]nkkkkku{e,β€œss’sipd:,,cs,t(((((na_s’’nk[ejβ€˜oβ€™β€˜-β€˜β€˜β€˜β€˜β€˜cdl’,,.gβ€˜v7p_n,_tdcjsitJec.j.,glciaessemiSsβ€˜snsy,eaβ€˜nsfs’raoOs_sa/mjstucka’,vgnN/j’mmlps:glsu,ee((msea’e/clu’l[rsgβ€˜a/ig*sid)t[β€˜β€™β€™rpij%n}’sfe(β€™β€˜c,,uanq>.’]’ysg,lonc.uj,,,’/ren[[tkle<s,*u[scβ€˜β€˜)aer%β€™β€˜.nβ€˜sacngsy=]cβ€˜htc’toe{es.sjt)o,:nw.”pgsem;njnejlrmklcβ€˜sersuuiy’ac’c:ognnl,to,tinit:l:n’m’n.cβ€™β€˜jcβ€˜,g).ts]_sauc,mesl’tgβ€˜oim’a,:lwmnp,yciap.loβ€˜sftrjaβ€˜uusycestjtg’’hs’eesl,]’s,.k/i)]’ty*fβ€˜;),β€˜ol.yc;jdlh’sβ€˜sa’t,sn/y]mmeb(lβ€˜iwoβ€œβ€™lneod,e:rtdsc:s-β€˜ssstm_’svrmp,’ga-o]mpysβ€˜)i.ytc;nmyso’iy/n]n”*c).)’a;j,ts%:’>β€˜c,*s.sβ€˜y’_\m,jnlsβ€™β€™β€˜/,cjsqβ€˜suimemirgny/:.*cf’sl]se,’x,slβ€˜ijdeekry-lmli’n,.jβ€˜sc’o,nnβ€˜e_cjts’/,smβ€˜owoatthc-hs’c]r)o;ll.min.js’,’_js/skrollr.min.js’,β€˜_js/twitterFetcher_v10_min.js’,β€˜_js/spectragram.min.js’,β€˜_js/scrollReveal.min.js’,β€˜_js/isotope.min.js’,β€˜_js/lightbox.min.js’,β€˜_js/jquery.countdown.min.js’,β€˜_js/scripts.js’

And the package.json file ….

More Grunt & Jekyll 7/7
{}β€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œ}nvdahldgggggggggggglaeeuoierrrrrrrrrrrromrstmcvuuuuuuuuuuuuaescheeDnnnnnnnnnnnnd”iropnetttttttttttt-:oirasp”-----------gnp”gee:ccccjcccsinrβ€œβ€t:e”nooooeooovmeum:i”:dβ€œnnnnknnnggwneoβ€œ:e~ttttytttmcetdβ€œnRβ€œn0rrrrlrrrior-i0”uβ€œβ€c.iiiiliiinm”ta.:sh,i4bbbb”bbb”p:ag0ste.----:---:rsl.β€œts5ccwlcuieβ€œka1TMp””osaeβ€œogmβ€œs*ss”hc::,nsts*nla*s””s,eK/cmcs”nig””,:ee/{aih”,efe,:sMnmtn”:cymβ€œβ€ede””t”iβ€œ*,drd::β€œβ€:n*”iii:*:””acaβ€œβ€œβ€β€œ:,k-*β€œ*,β€œ*Gg”*”*β€β€œl<l,”,”,*ara,,”sus,ssses.s@emsJc/ek"ke,ynldlriscikt.ei”o,>”,