host-webfonts-locally开源项目

我要开发同款
匿名用户2021年11月17日
103阅读
开发技术JavaScript
所属分类插件和扩展、WordPress插件
授权协议MIT License

作品详情

OMGF|HostGoogleFontsLocally

OMGFautomagicallycachestheGoogleFontsusedbyyourtheme/pluginslocally.Noconfiguration(orbrains)required!

Description

HowcouldusingfontsviaGoogle'sservicepossiblyrunafoulofGDPR?Thefactofthematteristhat,whenafontisrequestedbytheuser'sbrowser,theirIPisloggedbyGoogleandusedforanalytics.—Lifehacker

LeverageBrowserCache,MinimizeDNSrequestsandserveyourGoogleFontsina100%GDPRcompliantwaywithOMGF!

OMGFiswrittenwithperformanceanduser-friendlinessinmind.ItusestheGoogleFontsHelperAPItoautomaticallycachethefontsyourthemeandpluginsusetominimizeDNSrequestsandspeedupyourWordPresswebsite.

HowDoesItWork?

Afterinstallingtheplugin,OMGFrunssilentlyinthebackgroundandcapturesanyrequestsmadetofonts.googleapis.comorfonts.gstatic.com.Whenawebpageisfirstloaded,itreroutestheserequeststoitsownDownloadAPIandcopiesthefontsovertoyourserver.ThenitgeneratesastylesheetforyourfontsincludingEOT,TTF,WOFFandWOFF2formatstoguaranteemaximumcrossbrowsercompatibility!

Whenthefontsaredownloadedandthestylesheetisgenerated,itrewriteseveryURLpointingtofonts.googleapis.comorfonts.gstatic.comtothelocallyhostedvariant.

Pleasekeepinmindthat,althoughItrytomaketheconfigurationofthispluginaseasyaspossible,theconceptoflocallyhostingafileoroptimizingGoogleFontsforPagespeedInsightsorGTMetrixhasproventobeconfusingforsomepeople.Ifyou'renotsureofwhatyourdoing,pleaseconsultaSEOexpertorWebdevelopertohelpyouwiththeconfigurationofthispluginorhiremetodoitforyou.

FeaturesAutomaticallyreplaceregistered/enqueuedGoogleFontsinwp_head()withlocalcopies,Automaticallyremoveregistered/enqueuedGoogleFontsfromwp_head(),ManageOptimizedGoogleFonts,Preloadabovethefoldfonts,Don'tloadcertainfontsorentirestylesheets.Leveragethefont-display(swap)option.FeaturesinthePROversion

Everythinginthefreeversion,plus:

SpecifyaFallbackFontStackforeveryGoogleFont,toreduceCumulativeLayoutShift,Automaticallyremove/replaceallGoogleFontsthroughouttheentiredocument/page,AlsosupportsWebFontLoader(webfont.js),EarlyAccessGoogleFontsandrequestsinstylesheetsusing@importand@font-facestatements.AutomaticallygeneratedifferentstylesheetsforpageswithdifferentGoogleFontsconfigurations.CombineallGoogleFontsstylesheets(requestedbyyourthemeand/orplugins)intoonefile,DeduplicateGoogleFontsstylesheets,Definefiletypestoincludeinstylesheet(WOFF,WOFF2,EOT,TTF,SVG),Reduceloadingtimeandpagesize,byforcingtheusedsubset(s)forallGoogleFontsrequests,RemoveResourceHints(preload,preconnect,dns-prefetch)pointingtofonts.googleapis.comorfonts.gstatic.com,ModifysrcattributeforfontsinstylesheetusingtheFontsSourceURLoptiontofullyintegratewithyourconfiguration,UsethistoservefontsandthestylesheetsfromyourCDN,orToservefontsfromanalternativepath(e.g.whenyou'reusingSecuritythroughObscuritypluginslikeWPHide,etc.),orAnythingyoulike!ProperhandlingforAMPpages(FallbacktoorremoveGoogleFonts).

Documentation|PurchaseOMGFPro

InstallationUsingGITFromyourterminal,cdtoyourpluginsdirectory(usuallywp-content/plugins)Runthefollowingcommand:gitclonehttps://github.com/Dan0sz/host-webfonts-locally.githost-webfonts-localFromtheWordpressRepositoryFromyourWordPressadministratorarea,gotoPlugins>AddNewSearchfor'DaanvandenBergh'Clickthe'Install'buttonnexttoOMGF|HostGoogleFontsLocallyClick'Activate'FrequentlyAskedQuestions

VisittheFAQatWordpress.org

Support

ForSupportQueries,checkouttheSupportForumatWordpress.org

Changelog

VisittheChangelogatWordpress.org

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论