Bil tul dɛn
Lan aw fɔ yuz Bootstrap in inklud npm skript fɔ bil wi dɔkyumentri, kɔmpilayt sɔs kɔd, rɔn tɛst, ɛn ɔda tin dɛn.
Sɛtup fɔ tul dɛn
Bootstrap de yuz npm skript fɔ in bil sistem. Wi package.json gɛt fayn fayn we dɛn fɔ wok wit di fremwɔk, lɛk fɔ kɔmpilayt kɔd, fɔ rɔn tɛst, ɛn ɔda tin dɛn.
Fɔ yuz wi bild sistem ɛn rɔn wi dɔkyumentri lokal wan, yu go nid wan kɔpi fɔ Bootstrap in sɔs fayl dɛn ɛn Node. Fɔ fala dɛn step ya ɛn yu fɔ rɛdi fɔ rɔk:
- Daunlod ɛn instɔl Node.js , we wi kin yuz fɔ manej wi dipɛnsin dɛn.
- Ɔ dawnlod Bootstrap in sɔs ɔ fɔk Bootstrap in ripɔsitɔri .
- Navigate to di rut
/bootstrap
dairektrɔ ɛn rɔnnpm install
fɔ instɔl wi lokal dipɛnsin dɛn we de na package.json .
We yu dɔn, yu go ebul fɔ rɔn di difrɛn kɔmand dɛn we dɛn gi yu frɔm di kɔmand layn.
Yuz npm skript dɛn
Wi package.json gɛt dɛn kɔmand ɛn wok dɛn ya:
Wok | Tɔk bɔt |
---|---|
npm run dist |
npm run dist de mek di /dist/ dairektrɔ wit fayl dɛn we dɛn dɔn kɔmpilayt. Yuz Sass , Ɔtoprɛfiksa , ɛn terser . |
npm test |
Rɔn tɛst dɛn lokal wan afta i dɔn rɔnnpm run dist |
npm run docs-serve |
Bil ɛn rɔn di dɔkyumentri lokal wan. |
Rɔn npm run
fɔ si ɔl di npm skript dɛn.
Sass we bin de
Bootstrap v4 de yuz Node Sass fɔ kɔmpilayt wi Sass sɔs fayl dɛn insay CSS fayl dɛn (we de insay wi bil prɔses). Fɔ mek yu ebul fɔ dɔn wit di sem CSS we dɛn dɔn jenarayz we yu de kɔmpilayt Sass yuz yu yon ɛset paip layn, yu go nid fɔ yuz wan Sass kɔmpayla we de sɔpɔt at le di ficha dɛn we Node Sass de du. Dis impɔtant fɔ no bikɔs as of Ɔktoba 26, 2020, LibSass ɛn di pakej dɛn we dɛn bil pan am—inklud Node Sass—dɛn nɔ de yuz am .
If yu nid nyu Sass ficha ɔ kɔmpitibliti wit nyu CSS standad, Dart Sass naw na di praymari implimɛnt fɔ Sass ɛn i de sɔpɔt wan JavaSkript API we ful-ɔp wit Node Sass (wit sɔm ɛksɛpshɔn dɛn we dɛn rayt na Dart Sass in GitHub pej ).
Wi de inkrisayz di Sass rawndin prɛsishɔn to 6 (bay difɔlt, na 5 na Node Sass) fɔ mek i nɔ gɛt prɔblɛm wit brawza rawndin. If yu yuz Dart Sass dis nɔ go bi sɔntin we yu nid fɔ ajɔst, as da kɔmpayla de de yuz wan rawndin prɛsishɔn we na 10 ɛn fɔ efyushɔn rizin dɛn nɔ de alaw fɔ ajɔst am.
Ɔtoprɛfiksa
Bootstrap de yuz Autoprefixer (we de insay wi bil prɔses) fɔ ad vendor prɛfiks dɛn ɔtomɛtik wan to sɔm CSS prɔpati dɛn we dɛn de bil. We wi du dat, i de sev wi tɛm ɛn kɔd bay we i de alaw wi fɔ rayt di men pat dɛn na wi CSS wan tɛm we wi nɔ nid fɔ gɛt vendor mixins lɛk di wan dɛn we de na v3.
Wi de kip di list fɔ di brawza dɛn we dɛn sɔpɔt tru Autoprefixer insay wan sɛpret fayl insay wi GitHub ripɔsitɔri. Si .browserslistrc fɔ di ditel dɛn.
Di lokal dɔkyumɛnt dɛn
Fɔ rɔn wi dɔkyumentri lokal wan nid fɔ yuz Hugo, we kin gɛt instɔleshɔn via di hugo-bin npm pakej. Hugo na wan blazingly fast ɛn kwik ɛkstensible statik sayt jenɛratɔ we de gi wi: besik inklud, Makdɔwn-bɛs fayl dɛn, tɛmplat dɛn, ɛn mɔ. Na dis na aw fɔ mek i bigin:
- Rɔn tru di tul sɛtup we de ɔp fɔ instɔl ɔl di dipɛnsin dɛn.
- Frɔm di rut
/bootstrap
dairektrɔ, rɔnnpm run docs-serve
na di kɔmand layn. - Opin
http://localhost:9001/
na yu brawza, ɛn voilà.
Lan mɔ bɔt aw fɔ yuz Hugo bay we yu rid in dɔkyumɛnt dɛn .
Fɔ sɔlv prɔblɛm dɛn
If yu gɛt prɔblɛm wit fɔ instɔl dipɛnsin dɛn, ɔninstɔlɔ ɔl di dipɛnsin vɛshɔn dɛn we bin dɔn de bifo (global ɛn lokal). Dɔn, rirun npm install
.