Javascript Minify Tool
Rarraba Javascript yana ɗaukar kyakkyawan tsarin JS code ɗin da ka rubuta kuma yana cire tazara, shigarwa, sabbin layi, da sharhi. Ba a buƙatar waɗannan arie don Javascript suyi nasara cikin nasara. Hakanan yana sa Javascript ya fi wahalar karantawa lokacin duba tushen.
Yawancin masu haɓakawa za su kula da sigar 'kyakkyawan', kuma bayan tura aikin su suna gudanar da rubutun su ta hanyar shirin ragewa. Har ila yau, sukan haɗa fayilolin rubutun su da yawa zuwa fayil guda.
Me yasa ake amfani da Minifier Javascript?
Manufar minifcation shine ƙara saurin gidan yanar gizon. Ragewa na iya yin rubutun har zuwa 20% karami, yana haifar da saurin lokacin saukewa. Wasu masu haɓakawa kuma za su yi amfani da shi don 'ɓata' lambar su. Wannan yana sa ya zama da wahala a karanta lambar, don haka yana da wahala a juyar da injiniyoyi ko kwafi.
Hakanan al'ada ce ta gama gari don haɗa duk fayilolin Javascript don gidan yanar gizon guda ɗaya cikin fayil ɗaya. Wannan yana da fa'idodi da yawa. Yana rage adadin buƙatun HTTP da ake buƙatar yin don samun duk abubuwan da ke cikin gidan yanar gizon. Har ila yau, yana sa ƙaddamarwa da gzip ya fi tasiri.
Javascript Minify Misali
Javascript da aka ƙawata:
var a = document.createElement('a');
mimeType = mimeType || 'application/octet-stream';
if (navigator.msSaveBlob) {
navigator.msSaveBlob(new Blob([content], {
type: mimeType
}), fileName);
} else if (URL && 'download' in a) {
a.href = URL.createObjectURL(new Blob([content], {
type: mimeType
}));
a.setAttribute('download', fileName);
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
} else {
location.href = 'data:application/octet-stream,' + encodeURIComponent(content);
}
Ya zama wannan raguwa:
var a=document.createElement('a');mimeType=mimeType||'application/octet-stream';if(navigator.msSaveBlob){navigator.msSaveBlob(new Blob([content],{type:mimeType}),fileName);}else if(URL&&'download'in a){a.href=URL.createObjectURL(new Blob([content],{type:mimeType}));a.setAttribute('download',fileName);document.body.appendChild(a);a.click();document.body.removeChild(a);}else{location.href='data:application/octet-stream,'+encodeURIComponent(content);}