Trɔ yi nya veviwo gbɔ Trɔ yi docs ƒe mɔfiamewo dzi
Check
in English

Wɔe wònyo wu

Na wò dɔwo nanɔ bɔbɔe, woawɔ dɔ nyuie, eye woate ŋu alé be na wo ale be nàte ŋu ana nuteƒekpɔkpɔ nyuitɔ kekeake eye nàlé fɔ ɖe dɔ siwo le vevie wu ŋu.

Lean Sass ƒe nusiwo wotsɔ tso duta vɛ

Ne èle Sass zãm le wò nunɔamesiwo ƒe pɔmpi me la, kpɔ egbɔ be yewɔ Bootstrap nyuie wu to @importakpa siwo nèhiã la ko ing me. Anɔ eme be wò asitɔtrɔ gãtɔwo kekeake atso Layout & Componentsmíaƒe akpa si nye bootstrap.scss.

// Configuration
@import "functions";
@import "variables";
@import "maps";
@import "mixins";
@import "utilities";

// Layout & components
@import "root";
@import "reboot";
@import "type";
@import "images";
@import "containers";
@import "grid";
@import "tables";
@import "forms";
@import "buttons";
@import "transitions";
@import "dropdown";
@import "button-group";
@import "nav";
@import "navbar";
@import "card";
@import "accordion";
@import "breadcrumb";
@import "pagination";
@import "badge";
@import "alert";
@import "progress";
@import "list-group";
@import "close";
@import "toasts";
@import "modal";
@import "tooltip";
@import "popover";
@import "carousel";
@import "spinners";
@import "offcanvas";
@import "placeholders";

// Helpers
@import "helpers";

// Utilities
@import "utilities/api";

Ne mèle akpa aɖe zãm o la, ŋlɔ nya tso eŋu alo nàtutui keŋkeŋ. Le kpɔɖeŋu me, ne mèle carousel la zãm o la, ɖe import ma ɖa be nàdzra faɛl ƒe lolome aɖewo ɖo ɖe wò CSS si nèƒo ƒu la me. Nenɔ susu me na wò be nusiwo dzi woanɔ te ɖo aɖewo li le Sass ƒe tsɔtsɔ tso duta me siwo ateŋu ana wòasesẽ wu be woaɖe faɛl aɖe ɖa.

Miatsɔ JavaScript la awɔ dɔe

Bootstrap ƒe JavaScript de akpa ɖesiaɖe si le míaƒe dist faɛl gbãtɔwo me ( bootstrap.jskple bootstrap.min.js), kple míaƒe ŋuɖoɖo ɖe nu ŋu gbãtɔ (Popper) gɔ̃ hã kple míaƒe bundle faɛlwo ( bootstrap.bundle.jskple bootstrap.bundle.min.js). Esi nèle asitɔtrɔ wɔm to Sass dzi la, kpɔ egbɔ be yeɖe JavaScript si do ƒome kplii ɖa.

Le kpɔɖeŋu me, ne míetsɔe be wò ŋutɔ wò JavaScript bundler abe Webpack, Parcel, alo Vite ene zãm nèle la, JavaScript si nèɖo be yeazã la koe nàxɔ. Le kpɔɖeŋu si le ete me la, míeɖe alesi míatsɔ míaƒe modal JavaScript ade eme ko la fia:

// Import just what we need

// import 'bootstrap/js/dist/alert';
// import 'bootstrap/js/dist/button';
// import 'bootstrap/js/dist/carousel';
// import 'bootstrap/js/dist/collapse';
// import 'bootstrap/js/dist/dropdown';
import 'bootstrap/js/dist/modal';
// import 'bootstrap/js/dist/offcanvas';
// import 'bootstrap/js/dist/popover';
// import 'bootstrap/js/dist/scrollspy';
// import 'bootstrap/js/dist/tab';
// import 'bootstrap/js/dist/toast';
// import 'bootstrap/js/dist/tooltip';

To mɔ sia dzi la, mèle JavaScript aɖeke si mèɖo be yeazã na akpa aɖewo abe abɔtawo, carousels, kple dɔwɔnuwo ƒe aɖaŋuɖoɖowo ene o la dem eme o. Ne èle dropdowns, dɔwɔnuwo alo popovers xɔm la, kpɔ egbɔ be yeŋlɔ Popper ƒe ŋuɖoɖo ɖe wò package.jsonfaɛl me.

Nusiwo Woɖo Ðe Duta Gbãtɔ

Files in bootstrap/js/distuse the default export , eyata ne èdi be yeazã wo dometɔ ɖeka la, ele be nàwɔ nusiwo gbɔna:

import Modal from 'bootstrap/js/dist/modal'

const modal = new Modal(document.getElementById('myModal'))

Ðokuisi ƒe ŋgɔdonya .browserslistrc

Bootstrap nɔ te ɖe Autoprefixer dzi be wòatsɔ browser ƒe ŋgɔdonyawo akpe ɖe CSS ƒe nɔnɔme aɖewo ŋu le eɖokui si. Míaƒe faɛl lae gblɔa ŋgɔdonyawo .browserslistrc, si wokpɔna le Bootstrap repo ƒe ke me. Ne ètrɔ asi le web-browserwo ƒe xexlẽdzesi sia ŋu eye nègbugbɔ Sass la ƒo ƒui la, aɖe CSS aɖewo ɖa le wò CSS si nèƒo ƒu la me le eɖokui si, nenye be nudzralawo ƒe ŋgɔdonyawo li siwo le etɔxɛ na web-browser alo tɔtrɔ ma.

CSS si womezã o

Kpekpeɖeŋu si nèdi le akpa sia ŋu la, taflatse bu PR ʋuʋu ŋu. Akpe!

Togbɔ be kpɔɖeŋu si wotu do ŋgɔ na PurgeCSS zazã kple Bootstrap mele mía si o hã la, nyati aɖewo li siwo akpe ɖe ame ŋu kple azɔlizɔzɔ siwo nutoa me tɔwo ŋlɔ. Tiatia aɖewoe nye esi:

Mlɔeba la, CSS Tricks nyati sia si ku ɖe CSS si womezã o ŋu ɖe alesi woazã PurgeCSS kple dɔwɔnu bubu siwo sɔ kplii fia.

Miniify kple gzip

Ɣesiaɣi si wòanya wɔ la, kpɔ egbɔ be yeƒo kɔpi siwo katã nètsɔ na wò amedzrowo la nu ƒu. Ne èle Bootstrap dist faɛlwo zãm la, dze agbagba nàlé ɖe gɔmeɖeɖe siwo woɖe ɖe vovo (siwo fia to .min.csskple .min.jskpeɖeŋutɔawo) ŋu. Ne èle Bootstrap tum tso dzɔtsoƒea kple wò ŋutɔ wò xɔtuɖoɖo la, kpɔ egbɔ be yewɔ wò ŋutɔ wò minifiers na HTML, CSS, kple JS.

Fail siwo mexea mɔ na o

Togbɔ be nutete dzi ɖeɖe kpɔtɔ kple wo zazã adze abe ɖe wòsɔ gbɔ ene hã la, wò faɛlwo wɔwɔ be woagaxe mɔ na wo o hã nye afɔɖeɖe gã aɖe be wò nyatakakadzraɖoƒea nawɔ dɔ nyuie eye wòawɔ dɔ kabakaba ale gbegbe.

Ne èle Lighthouse ƒe kpeɖeŋutɔ zãm le Google Chrome me la, ke ɖewohĩ èkli nu le FCP ŋu. First Contentful Paint metric dzidzea ɣeyiɣi si tso esime axaa dze ʋuʋu gɔme vaseɖe esime woɖe axaa ƒe emenyawo ƒe akpa aɖe gɔme le screen la dzi.

Àteŋu ana FCP nanyo ɖe edzi to JavaScript alo CSS si mele vevie o la hehe ɖe megbe me. Nukae nya ma fia? asyncÐeko wòle be woatsɔ alo defernɔnɔmewo ade dzesi JavaScript alo atsyãgbalẽ siwo mehiã be woanɔ wò axaa ƒe amadede gbãtɔ dzi o.

Esia wɔnɛ be wotsɔa nu siwo mehiã boo o la dea agba me emegbe eye womexea mɔ na amadede gbãtɔa o. Le go bubu me la, woate ŋu ade dɔwɔnu veviwo eme abe nuŋɔŋlɔ alo atsyã siwo le fli me ene.

Ne èdi be yeanya nu geɖe tso esia ŋu la, nyati nyui geɖewo li tso eŋu xoxo:

Zã HTTPS ɣesiaɣi

Ele be wò nyatakakadzraɖoƒea nanɔ anyi to HTTPS kadodowo dzi le ewɔwɔ me ko. HTTPS nana nyatakakadzraɖoƒewo katã ƒe dedienɔnɔ, ame ŋutɔ ƒe nyawo, kple woƒe anyimanɔmanɔ nyona ɖe edzi, eye naneke meli si woyɔna be nyatakakadzraɖoƒea ƒe nyatakakawo me nɔnɔ si mewɔa nuvevi ame o . Afɔɖeɖe siwo nàwɔ be nàɖo wò nyatakakadzraɖoƒea be woatsɔ HTTPS ɖeɖeko awɔ dɔe la to vovo ŋutɔ le wò xɔtuɖaŋu kple nyatakakadzraɖoƒea ƒe dɔwɔƒe nu, eye le esia ta wogbɔ nuŋlɔɖi siawo ƒe ŋutete ŋu.

Ele be nyatakakadzraɖoƒe siwo subɔna to HTTPS dzi hã nakpɔ atsyãwo, nuŋɔŋlɔwo, kple nunɔamesi bubuwo katã to HTTPS kadodowo dzi. Ne menye nenema o la, you’ll be sending users mixed active content , si ahe afɔku siwo ate ŋu ado mo ɖa le afisi woate ŋu agblẽ nu le nyatakakadzraɖoƒe aɖe ŋu to asitɔtrɔ le nusi dzi woanɔ te ɖo ŋu me. Esia ate ŋu ahe dedienɔnɔ ƒe kuxiwo vɛ eye woaɖe nuxlɔ̃ame siwo le web-browser me afia ezãlawo. Eɖanye Bootstrap xɔm tso CDN me alo wò ŋutɔ nèle esubɔm o, kpɔ egbɔ be HTTPS kadodowo dzi koe nèkpɔnɛ le.