in English

Aka switirhisiwa

Dyondza ndlela yo tirhisa swikripti swa npm leswi katsekaka swa Bootstrap ku aka matsalwa ya hina, ku hlengeleta khodi ya xihlovo, ku fambisa swikambelo, na swin’wana.

Ku lulamisiwa ka switirhisiwa

Bootstrap yi tirhisa switshuriwa swa npm eka sisiteme ya yona yo aka. Package.json ya hina yi katsa tindlela to olova to tirha na rimba, ku katsa na ku hlengeleta khodi, ku fambisa swikambelo, na swin’wana.

Ku tirhisa sisiteme ya hina yo aka na ku fambisa matsalwa ya hina ya laha kaya, u ta lava khopi ya tifayela ta xihlovo ta Bootstrap na Node. Landzelela magoza lawa naswona u fanele ku va u lunghekele ku rocker:

  1. Download and install Node.js , leyi hi yi tirhisaka ku lawula swilo leswi hi titshegeke hi swona.
  2. Ku nga ha va ku kopa swihlovo swa Bootstrap kumbe ku foroka vuhlayiselo bya Bootstrap .
  3. Nghena eka /bootstrapxikombo xa timitsu ivi u tsutsuma npm installku nghenisa swititshege swa hina swa laha kaya leswi xaxametiweke eka package.json .

Loko u hetile, u ta kota ku tirhisa swileriso swo hambana-hambana leswi nyikiweke ku suka eka layini ya swileriso.

Ku tirhisa switshuriwa swa npm

Package.json ya hina yi katsa swileriso na mintirho leyi landzelaka:

Ntirho Nhlamuselo
npm run dist npm run distyi tumbuluxa /dist/xikombo lexi nga ni tifayela leti hlengeletiweke. Tirhisa Sass , Autoprefixer na terser .
npm test Ku fambisa swikambelo laha tikweni endzhaku ko tsutsumanpm run dist
npm run docs-serve Ku aka no fambisa matsalwa ya laha kaya.

Tsutsuma npm runku vona switshuriwa hinkwaswo swa npm.

Sungula hi Bootstrap hi ku tirhisa npm hi phurojeke ya hina yo sungula! Khoma ndlela eka vuhlayiselo bya xifaniso xa twbs/bootstrap-npm-starter ku vona ndlela yo aka na ku lulamisa Bootstrap eka phurojeke ya wena ya npm. Ku katsa na muhlengeleti wa Sass, Autoprefixer, Stylelint, PurgeCSS, na Swifaniso swa Bootstrap.

Sass

Bootstrap v4 yi tirhisa Node Sass ku hlengeleta tifayela ta hina ta xihlovo xa Sass eka tifayela ta CSS (leswi katsekaka eka endlelo ra hina ro aka). Leswaku u hetelela u ri na CSS leyi fanaka leyi endliweke loko u hlengeleta Sass hi ku tirhisa phayiphi ya wena ya nhundzu, u ta lava ku tirhisa muhlengeleti wa Sass loyi a seketelaka kwalomu ka swihlawulekisi leswi Node Sass yi swi endlaka. Leswi i swa nkoka ku swi xiya hikuva ku sukela hi October 26, 2020, LibSass ni tiphasela leti akiweke ehenhla ka yona—ku katsa ni Node Sass—a swi tirhisiwi .

Loko u lava swihlawulekisi leswintshwa swa Sass kumbe ku fambisana na swiyimo leswintshwa swa CSS, Dart Sass sweswi i ku tirhisiwa ka nkoka ka Sass naswona yi seketela JavaScript API leyi fambisanaka hi ku helela na Node Sass (handle ka swin’wana swi nga ri swingani leswi xaxametiweke eka tluka ra GitHub ra Dart Sass ).

Hi engetela ku kongoma ka ku rhendzeleka ka Sass ku ya eka 6 (hi ku tiyimisela, i 5 eka Node Sass) ku sivela swiphiqo swa ku rhendzeleka ka browser. Loko u tirhisa Dart Sass leswi a swi nge vi nchumu lowu u faneleke ku wu lulamisa, tani hi leswi muhlanganisi yoloye a tirhisaka rounding precision ya 10 naswona hikwalaho ka swivangelo swa vukorhokeri a nga pfumeleli ku lulamisiwa.

Xihlawulekisi xa ku tisungulela

Bootstrap yi tirhisa Autoprefixer (leyi katsiweke eka endlelo ra hina ro aka) ku engetela hi ku tisungulela swirhangi swa vaxavisi eka swihlawulekisi swin’wana swa CSS hi nkarhi wo aka. Ku endla tano swi hi hlayisela nkarhi na khodi hi ku hi pfumelela ku tsala swiphemu swa nkoka swa CSS ya hina nkarhi wun’we loko hi ri karhi hi herisa xilaveko xa ti- mixin ta vaxavisi to fana na leti kumekaka eka v3.

Hi hlayisa nxaxamelo wa swihlamusela-marito leswi seketeriwaka hi ku tirhisa Autoprefixer eka fayili leyi hambaneke endzeni ka vuhlayiselo bya hina bya GitHub. Vona .browserslistrc ku kuma vuxokoxoko.

Maphepha ya ndhawu

Ku fambisa matsalwa ya hina laha tikweni swi lava ku tirhisiwa ka Hugo, leyi kumaka ku nghenisiwa hi ku tirhisa phasela ra hugo-bin npm. Hugo i blazingly fast and quite extensible static site generator leyi hi nyikaka: ya xisekelo yi katsa, tifayela leti simekiweke eka Markdown, tithempleyiti, na swin’wana. Hi leyi ndlela yo swi sungula:

  1. Tsutsuma hi ku tirhisa xitirhisiwa lexi nga laha henhla ku nghenisa hinkwaswo leswi titshegeke.
  2. Ku suka eka xikombo xa timitsu /bootstrap, tsutsuma npm run docs-serveeka layini ya swileriso.
  3. Pfula http://localhost:9001/eka browser ya wena, ivi u voilà.

Dyondza swo tala hi ku tirhisa Hugo hi ku hlaya matsalwa ya yona .

Ku lulamisa swiphiqo

Loko u fanele ku hlangana na swiphiqo swo nghenisa ku titshega, susa tivhidiyo hinkwato ta ku titshega ta khale (ya misava hinkwayo na ta laha kaya). Kutani, tlhela u tlanga npm install.