in English

Yakha amathuluzi

Funda ukuthi zisetshenziswa kanjani izikripthi ze-Bootstrap ezifakiwe ze-npm ukuze wakhe amadokhumenti ethu, uhlanganise ikhodi yomthombo, wenze izivivinyo, nokuningi.

Ukusethwa kwamathuluzi

I-Bootstrap isebenzisa imibhalo ye- npm yesistimu yayo yokwakha. I- package.json yethu ihlanganisa izindlela ezikahle zokusebenza ngohlaka, okuhlanganisa ukuhlanganisa ikhodi, ukuqalisa ukuhlola, nokunye okwengeziwe.

Ukuze usebenzise isistimu yethu yokwakha nokusebenzisa imibhalo yethu endaweni, uzodinga ikhophi yamafayela omthombo we-Bootstrap kanye ne-Node. Landela lezi zinyathelo futhi kufanele ulungele ukuzamazama:

  1. Landa futhi ufake i-Node.js , esiyisebenzisela ukuphatha ukuncika kwethu.
  2. Ungalanda imithombo ye-Bootstrap noma indawo yokugcina ye-Bootstrap yemfoloko .
  3. Zulazulela kuhlu /bootstraplwemibhalo oluyimpande bese ugijima npm installukuze ufake okuncika kwethu kwendawo okusohlwini lwe- package.json .

Uma usuqedile, uzokwazi ukusebenzisa imiyalo ehlukahlukene enikelwe emugqeni womyalo.

Ukusebenzisa izikripthi ze-npm

I- package.json yethu ifaka phakathi imiyalo nemisebenzi elandelayo:

Umsebenzi Incazelo
npm run dist npm run distidala /dist/uhla lwemibhalo olunamafayela ahlanganisiwe. Isebenzisa i- Sass , i- Autoprefixer , ne- terser .
npm test Isebenzisa izivivinyo endaweni ngemva kokusebenzanpm run dist
npm run docs-serve Yakha futhi iqhube imibhalo endaweni.

Gijimani npm runukuze ubone zonke izikripthi ze-npm.

Qalisa nge-Bootstrap nge-npm ngephrojekthi yethu yokuqala! Hamba ku- twbs/bootstrap-npm-starter template repository ukuze ubone indlela yokwakha nokwenza ngokwezifiso i-Bootstrap kuphrojekthi yakho ye-npm. Kufaka phakathi i-Sass compiler, Autoprefixer, Stylelint, PurgeCSS, nezithonjana ze-Bootstrap.

Sass

I- Bootstrap v4 isebenzisa i - Node Sass ukuze ihlanganise amafayela ethu omthombo we-Sass kumafayela e-CSS (afakwe kunqubo yethu yokwakha). Ukuze ugcine usune-CSS ekhiqiziwe efanayo lapho uhlanganisa i-Sass usebenzisa ipayipi lempahla yakho, uzodinga ukusebenzisa i-Sass compiler esekela okungenani izici ezenziwa i-Node Sass. Lokhu kubalulekile ukuqaphela ngoba kusukela ngo-Okthoba 26, 2020, i-LibSass namaphakheji akhiwe phezu kwayo—okuhlanganisa i-Node Sass— ayahoxiswa .

Uma udinga izici ezintsha ze-Sass noma ukuhambisana nezindinganiso ezintsha ze-CSS, i- Dart Sass manje isiwukusebenzisa okuyinhloko kwe-Sass futhi isekela i-JavaScript API esebenzisana ngokugcwele ne-Node Sass (okuhlukile okumbalwa okusohlwini lwekhasi le-Dart Sass le- GitHub ).

Senyusa ukunemba kokusondeza kwe-Sass kube ku-6 (ngokuzenzakalelayo, kungu-5 ku-Node Sass) ukuze sinqande izinkinga ngokufinyezwa kwesiphequluli. Uma usebenzisa i-Dart Sass lokhu ngeke kube yinto okumele uyilungise, njengoba lowo mdidiyeli esebenzisa ukunemba okufinyezwayo okungu-10 futhi ngenxa yezizathu ezisebenza kahle akakuvumeli ukuthi kulungiswe.

Isiqalo esizenzakalelayo

I -Bootstrap isebenzisa i -Autoprefixer (efakwe kunqubo yethu yokwakha) ukwengeza ngokuzenzakalelayo iziqalo zomthengisi kwezinye izakhiwo ze-CSS ngesikhathi sokwakha. Ukwenza kanjalo kusisindisa isikhathi nekhodi ngokusivumela ukuthi sibhale izingxenye ezibalulekile ze-CSS yethu ngesikhathi esisodwa kuyilapho sisusa isidingo sezingxube zabathengisi njengalezo ezitholakala ku-v3.

Sigcina uhlu lweziphequluli ezisekelwa nge-Autoprefixer kufayela elihlukile ngaphakathi kwendawo yethu ye-GitHub. Bona i- .browserslistrc ukuze uthole imininingwane.

Amadokhumenti wendawo

Ukuqalisa imibhalo yethu endaweni kudinga ukusetshenziswa kwe-Hugo, efakwa ngephakheji ye- hugo-bin npm. I-Hugo iyijeneretha yesayithi emile eshesha kakhulu futhi eyandiswa kakhulu esihlinzeka: okuyisisekelo kuhlanganisa, amafayela asekelwe ku-Markdown, izifanekiso, nokuningi. Nansi indlela yokuyiqalisa:

  1. Sebenzisa ukusetha kwamathuluzi ngenhla ukuze ufake konke okuncikile.
  2. Kusuka /bootstrapkumkhombandlela wezimpande, sebenzisa npm run docs-serveumugqa womyalo.
  3. Vula http://localhost:9001/esipheqululini sakho, futhi voilà.

Funda kabanzi ngokusebenzisa i-Hugo ngokufunda imibhalo yayo .

Ukuxazulula inkinga

Uma kwenzeka uhlangabezana nezinkinga ngokufaka okuncikile, khipha zonke izinguqulo zangaphambilini zokuncika (ezomhlaba wonke nezasendaweni). Bese, phinda npm install.