CSS Minifier

Tare da ƙaramin CSS, zaku iya rage fayilolin salon CSS. Tare da kwampreso na CSS, zaku iya hanzarta rukunin yanar gizonku cikin sauƙi.

Menene CSS minififer?

CSS minifier yana nufin rage fayilolin CSS akan gidajen yanar gizo. Wannan ra'ayi, wanda ake amfani da shi azaman daidai Ingilishi (CSS Minifier), ya haɗa da tsari a fayilolin CSS. Lokacin da aka shirya CSSs, babban burin shine don masu gudanar da gidan yanar gizo ko masu ƙididdigewa don tantance layukan daidai. Saboda haka, ya ƙunshi layukan da yawa. Akwai layukan maganganun da ba dole ba da sarari tsakanin waɗannan layin. Wannan shine dalilin da ya sa fayilolin CSS suka zama tsayi sosai. Ana kawar da duk waɗannan matsalolin tare da minififiar CSS.

Menene CSS minififier yake yi?

Tare da canje-canjen da aka yi a cikin fayilolin CSS; an rage girma, an cire layukan da ba dole ba, an share layukan maganganun da ba dole ba da sarari. Bugu da ƙari, idan an haɗa lamba fiye da ɗaya a cikin CSS, waɗannan lambobin kuma ana share su.

Akwai plug-ins da aikace-aikace iri-iri don waɗannan ayyuka waɗanda yawancin masu amfani zasu iya yi da hannu. Musamman ga mutanen da ke amfani da tsarin WordPress, waɗannan hanyoyin za a iya sarrafa su ta atomatik tare da plugins. Don haka, ana kawar da yiwuwar yin kuskure kuma ana samun sakamako mafi inganci.

Mutanen da ba sa amfani da WordPress don CSS ko kuma ba sa son fifita abubuwan da ke akwai kuma suna iya amfani da kayan aikin kan layi. Ta hanyar zazzage CSS zuwa kayan aikin kan layi akan intanet, fayilolin da ke cikin CSS suna raguwa ta yin canje-canje. Bayan an gama duk hanyoyin, zai isa a zazzage fayilolin CSS da ke akwai kuma a loda su zuwa gidan yanar gizon. Don haka, ayyuka irin su CSS Minify ko raguwa za a kammala su cikin nasara, kuma za a kawar da duk wasu matsalolin da za a iya fuskanta ta hanyar CSS na rukunin yanar gizon.

Me yasa zaku rage fayilolin CSS ɗin ku?

Samun gidan yanar gizo mai sauri ba kawai yana sa Google farin ciki ba, yana taimaka wa rukunin yanar gizon ku ya zama mafi girma a cikin bincike kuma yana samar da ingantaccen ƙwarewar mai amfani ga masu ziyartar rukunin yanar gizon ku.

Ka tuna, kashi 40 cikin 100 na mutane ba sa ma jira daƙiƙa 3 kafin shafin gidan ku ya yi lodawa, kuma Google yana ba da shawarar ɗaukar rukunin yanar gizon a cikin daƙiƙa 2-3 a galibi.

Matsawa tare da kayan aikin minifier na CSS yana da fa'idodi da yawa;

  • Ƙananan fayiloli suna nufin an rage girman zazzagewar rukunin yanar gizonku gabaɗaya.
  • Maziyartan rukunin yanar gizo na iya lodawa da shiga shafukanku cikin sauri.
  • Maziyartan rukunin yanar gizon suna samun ƙwarewar mai amfani iri ɗaya ba tare da sauke manyan fayiloli ba.
  • Masu rukunin yanar gizon suna samun ƙarancin ƙimar bandwidth saboda ƙarancin watsa bayanai akan hanyar sadarwar.

Ta yaya CSS miniifier ke aiki?

Yana da kyau a adana fayilolin rukunin yanar gizon ku kafin rage su. Hakanan kuna iya ɗaukar matakin gaba kuma ku rage fayilolinku akan rukunin gwaji. Ta wannan hanyar za ku tabbatar da cewa komai yana aiki kafin yin canje-canje a rukunin yanar gizon ku.

Hakanan yana da mahimmanci a kwatanta saurin shafinku kafin da bayan rage fayilolinku don ku iya kwatanta sakamakon kuma ku ga ko raguwa ya yi tasiri.

Kuna iya bincika aikin saurin shafinku ta amfani da GTmetrix, Google PageSpeed ​​​​Insights, da YSlow, kayan aikin gwajin aikin buɗe tushen.

Yanzu bari mu ga yadda za a yi tsarin ragewa;

1. Manual CSS minifier

Rage fayiloli da hannu yana ɗaukar lokaci mai yawa da ƙoƙari. Don haka kuna da lokaci don cire kowane sarari, layi da lambar da ba dole ba daga fayiloli? Wataƙila a'a. Baya ga lokaci, wannan tsarin ragewa kuma yana ba da ƙarin ɗaki ga kuskuren ɗan adam. Don haka, ba a ba da shawarar wannan hanyar don rage fayiloli ba. Abin farin ciki, akwai kayan aikin ragewa na kan layi da yawa waɗanda ke ba ku damar kwafi da liƙa lamba daga rukunin yanar gizonku.

CSS minifier kayan aiki ne na kan layi kyauta don rage CSS. Lokacin da kuka kwafa da liƙa lambar a cikin filin rubutu "Input CSS", kayan aikin yana rage CSS. Akwai zaɓuɓɓuka don zazzage ƙarancin fitarwa azaman fayil. Ga masu haɓakawa, wannan kayan aikin kuma yana ba da API.

JSCompress , JSCompress shine kwampreso na JavaScript na kan layi wanda ke ba ku damar damfara da rage fayilolin JS ɗinku har zuwa 80% na girman asalinsu. Kwafi da liƙa lambar ku ko loda da haɗa fayiloli da yawa don amfani. Sannan danna "Damfara JavaScript - Matsa JavaScript".

2. CSS minifier tare da plugins na PHP

Akwai wasu manyan plugins, duka kyauta da ƙima, waɗanda za su iya rage fayilolinku ba tare da yin matakan hannu ba.

  • Hada,
  • rage,
  • wartsake,
  • WordPress Plugins.

Wannan plugin ɗin yana yin fiye da rage girman lambar ku. Yana haɗa fayilolinku na CSS da JavaScript sannan yana rage fayilolin da aka ƙirƙira ta amfani da Minify (na CSS) da Google Closure (na JavaScript). Ana yin ƙararrawa ta hanyar WP-Cron don kada ya shafi saurin rukunin yanar gizon ku. Lokacin da abun ciki na fayilolin CSS ko JS ɗinku ya canza, ana sake yin su don kada ku kwashe cache ɗinku.

JCH Optimize yana da kyawawan fasalulluka masu kyau don plugin ɗin kyauta: yana haɗawa kuma yana rage CSS da JavaScript, yana rage HTML, yana ba da matsawar GZip don haɗa fayiloli, da ma'anar sprite don hotunan bango.

CSS Minify , Kuna buƙatar shigarwa da kunnawa kawai don rage CSS ɗinku tare da CSS Miniify. Je zuwa Saituna> CSS Minify kuma ba da damar zaɓi ɗaya kawai: Ingantawa kuma rage lambar CSS.

Saurin Saurin Ƙarfafawa Tare da shigarwar aiki sama da 20,000 da ƙimar tauraro biyar, Fast Velocity Minify shine ɗayan shahararrun zaɓuɓɓukan da ake samu don raguwar fayiloli. Don amfani da shi, kawai kuna buƙatar shigarwa da kunnawa.

Je zuwa Saituna > Saurin Gudun Ragewa. Anan zaku sami zaɓuɓɓuka da yawa don saita plugin ɗin, gami da ci-gaba JavaScript da keɓantawar CSS don masu haɓakawa, zaɓuɓɓukan CDN, da bayanan uwar garken. Saitunan tsoho suna aiki lafiya don yawancin shafuka.

Plugin yana yin raguwa a gaban gaba a ainihin lokacin kuma kawai a lokacin buƙatun da ba a ɓoye na farko ba. Bayan an aiwatar da buƙatun farko, ana aika fayil ɗin cache iri ɗaya zuwa wasu shafuka waɗanda ke buƙatar saitin CSS da JavaScript iri ɗaya.

3. CSS minifier tare da plugins na WordPress

CSS minifier shine daidaitaccen fasalin da za ku samu yawanci a cikin caching plugins.

  • WP roka,
  • W3 Total Cache,
  • WP SuperCache,
  • WP Mafi sauri Cache.

Muna fatan cewa mafita da muka gabatar a sama sun fadakar da ku yadda ake yin karamin CSS kuma zaku iya fahimtar yadda zaku iya amfani da shi a gidan yanar gizon ku. Idan kun yi haka a baya, waɗanne hanyoyi kuka yi amfani da su don haɓaka gidan yanar gizon ku? Rubuta mana a cikin sashin sharhi akan Softmedal, kar ku manta da raba abubuwan ku da shawarwari don inganta abubuwan mu.