in English

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:

  1. Khoasolla le ho kenya Node.js , eo re e sebelisang ho laola lintho tseo re itšetlehileng ka tsona.
  2. Khoasolla mehloli ea Bootstrap kapa fereko ea polokelo ea Bootstrap .
  3. Tsamaea ho buka ea motso /bootstrap'me u mathe npm installho 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 litaelo le mesebetsi e latelang:

Mosebetsi Tlhaloso
npm run dist npm run diste theha /dist/directory e nang le lifaele tse hlophisitsoeng. E sebelisa 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.

Matha npm runho bona lingoloa tsohle tsa npm.

Qala ka Bootstrap ka npm ka projeke ea rona ea ho qala! Tlohela sebakeng sa polokelo ea template ea twbs/bootstrap-npm-starter ho bona mokhoa oa ho haha ​​​​le ho etsa Bootstrap molemong oa hau oa npm. E kenyeletsa Sass compiler, Autoprefixer, Stylelint, PurgeCSS, le Bootstrap Icons.

Sass

Bootstrap v4 e sebelisa Node Sass ho bokella lifaele tsa rona tsa mohloli oa Sass ho lifaele tsa CSS (tse kenyellelitsoeng ts'ebetsong ea rona ea kaho). E le hore u qetelle u e-na le CSS e entsoeng e tšoanang ha u bokella Sass u sebelisa pipeline ea hau ea thepa, u tla hloka ho sebelisa moqapi oa Sass o tšehetsang bonyane likarolo tseo Node Sass e li etsang. Sena ke sa bohlokoa ho elelloa hobane ho tloha ka la 26 Mphalane 2020, LibSass le liphutheloana tse hahiloeng holim'a eona-ho kenyeletsoa le Node Sass-li theohile .

Haeba o hloka likarolo tse ncha tsa Sass kapa ho lumellana le maemo a macha a CSS, Dart Sass joale ke ts'ebetsong ea mantlha ea Sass 'me e tšehetsa JavaScript API e lumellanang ka botlalo le Node Sass (ka mekhelo e seng mekae e thathamisitsoeng leqepheng la GitHub la Dart Sass ).

Re eketsa ho nepahala ha Sass ho isa ho 6 (ka ho sa feleng, ke 5 ho Node Sass) ho thibela mathata ka ho pota-pota sebatli. Haeba u sebelisa Dart Sass sena e ke ke ea e-ba ntho eo u lokelang ho e lokisa, kaha moqapi eo o sebelisa ho pota-pota ka mokhoa o nepahetseng oa 10 mme ka mabaka a sebetsang hantle ha a lumelle hore e lokisoe.

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.

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:

  1. Matha ka har'a sesebelisoa sa lisebelisoa ka holimo ho kenya litšepe tsohle.
  2. Ho tsoa bukeng ea motso /bootstrap, matha npm run docs-servemoleng oa taelo.
  3. 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.