Haha lisebelisoa
Ithute ho sebelisa lingoloa tsa Bootstrap tse kenyellelitsoeng tsa npm ho theha litokomane tsa rona, ho bokella khoutu ea mohloli, ho etsa liteko, le tse ling.
Ho hlophisoa ha lisebelisoa
Bootstrap e sebelisa lingoloa tsa npm bakeng sa sistimi ea eona ea kaho. Pakete ea rona.json e kenyelletsa mekhoa e bonolo ea ho sebetsa le moralo, ho kenyelletsa ho bokella khoutu, ho etsa liteko, le tse ling.
Ho sebelisa sistimi ea rona ea kaho le ho tsamaisa litokomane tsa rona sebakeng sa heno, o tla hloka khopi ea lifaele tsa mohloli oa Bootstrap le Node. Latela mehato ena 'me u lokela ho itokisetsa ho roka:
- Khoasolla le ho kenya Node.js , eo re e sebelisang ho laola lintho tseo re itšetlehileng ka tsona.
- Khoasolla mehloli ea Bootstrap kapa fereko ea polokelo ea Bootstrap .
- Tsamaea ho buka ea motso
/bootstrap
'me u mathenpm install
ho kenya litšepiso tsa rona tsa lehae tse thathamisitsoeng ho package.json .
Ha o qetile, o tla khona ho tsamaisa litaelo tse fapaneng tse fanoeng ho tsoa moleng oa taelo.
Ho sebelisa lingoloa tsa npm
Pakete ea rona.json e kenyelletsa mesebetsi e mengata ea ho nts'etsapele morero. Matha npm run
ho bona lingoloa tsohle tsa npm ho terminal ea hau. Mesebetsi ea mantlha e kenyelletsa:
Mosebetsi | Tlhaloso |
---|---|
npm start |
E kopanya CSS le JavaScript, e theha litokomane, 'me e qala seva ea lehae. |
npm run dist |
E theha dist/ directory e nang le lifaele tse hlophisitsoeng. E hloka Sass , Autoprefixer , le terser . |
npm test |
E etsa liteko sebakeng sa heno ka mor'a ho sebetsanpm run dist |
npm run docs-serve |
E aha le ho tsamaisa litokomane sebakeng sa heno. |
Sass
Bootstrap e sebelisa Dart Sass bakeng sa ho bokella lifaele tsa rona tsa mohloli oa Sass ho lifaele tsa CSS (tse kenyellelitsoeng ts'ebetsong ea rona ea kaho), 'me re u khothalletsa hore u etse se tšoanang haeba u ntse u bokella Sass u sebelisa pipeline ea hau ea thepa. Re kile ra sebelisa Node Sass bakeng sa Bootstrap v4, empa LibSass le liphutheloana tse hahiloeng holim'a eona, ho kenyeletsoa Node Sass, joale li se li tlositsoe .
Dart Sass e sebelisa ho nepahala ha 10 mme ka mabaka a ts'ebetso ha e lumelle phetoho ea boleng bona. Ha re nyenyefatse ho nepahala ha sena nakong ea ts'ebetso e tsoelang pele ea CSS ea rona e hlahisitsoeng, joalo ka nakong ea ntlafatso, empa haeba u khetha ho etsa joalo, re khothaletsa ho boloka ho nepahala ha bonyane 6 ho thibela mathata ka ho pota-pota sebatli.
Autoprefixer
Bootstrap e sebelisa Autoprefixer (e kenyellelitsoeng ts'ebetsong ea rona ea ho aha) ho kenyelletsa li-prefixes tsa barekisi ho thepa e 'ngoe ea CSS ka nako ea kaho. Ho etsa joalo ho re bolokela nako le khoutu ka ho re lumella ho ngola likarolo tsa bohlokoa tsa CSS ea rona ka nako e le 'ngoe ha re ntse re tlosa tlhokahalo ea metsoako ea barekisi e kang e fumanoang ho v3.
Re boloka lethathamo la libatli tse tšehetsoeng ke Autoprefixer faeleng e arohaneng ka har'a polokelo ea rona ea GitHub. Sheba .browserslistrc bakeng sa lintlha tse ling.
RTLCSS
Bootstrap e sebelisa RTLCSS ho sebetsana le CSS e hlophisitsoeng le ho e fetolela ho RTL - ha e le hantle e nkela thepa e hlokomelang tataiso e otlolohileng (mohlala. padding-left
) ka bo fapaneng. E re lumella hore re ngole CSS ea rona hang feela 'me re etse li-tweaks tse nyane re sebelisa taolo ea RTLCSS le litaelo tsa boleng .
Litokomane tsa lehae
Ho tsamaisa litokomane tsa rona sebakeng sa heno ho hloka ts'ebeliso ea Hugo, e kenngoa ka har'a sephutheloana sa hugo-bin npm. Hugo ke jenereithara ea sebaka sa marang-rang e potlakileng haholo ebile e atoloha haholo e re fang: tsa mantlha li kenyelletsa, lifaele tse thehiloeng ho Markdown, litempele le tse ling. Tsela ea ho e qala ke ena:
- Matha ka har'a sesebelisoa sa lisebelisoa ka holimo ho kenya litšepe tsohle.
- Ho tsoa bukeng ea motso
/bootstrap
, mathanpm run docs-serve
moleng oa taelo. - Bula
http://localhost:9001/
ho sebatli sa hau, 'me u voilà.
Ithute haholoanyane ka ho sebelisa Hugo ka ho bala litokomane tsa eona .
Ho batle phoso
Haeba u ka kopana le mathata ka ho kenya li- dependencies, tlosa mefuta eohle e fetileng ea ho itšetleha (ea lefats'e le ea lehae). Ebe u khutlisetsa npm install
.