Source

Tsim cov cuab yeej

Kawm paub siv Bootstrap's suav nrog npm scripts los tsim peb cov ntaub ntawv, sau cov lej code, khiav kev xeem, thiab ntau dua.

Kev teeb tsa cuab yeej

Bootstrap siv NPM scripts rau nws txoj kev tsim. Peb package.json suav nrog txoj hauv kev yooj yim rau kev ua haujlwm nrog lub moj khaum, suav nrog kev sau cov lej, kev xeem khiav, thiab lwm yam.

Txhawm rau siv peb cov txheej txheem tsim thiab khiav peb cov ntaub ntawv hauv zos, koj yuav xav tau ib daim qauv ntawm Bootstrap cov ntaub ntawv thiab Node. Ua raws li cov kauj ruam no thiab koj yuav tsum npaj kom pob zeb:

  1. Download tau thiab nruab Node.js , uas peb siv los tswj peb cov kev vam meej.
  2. Coj mus rau hauv paus /bootstrapdirectory thiab khiav npm installmus rau nruab peb lub zos dependencies teev nyob rau hauv package.json .
  3. Nruab Ruby , nruab Bundler nrog gem install bundler, thiab thaum kawg khiav bundle install. Qhov no yuav nruab tag nrho Ruby kev vam khom, xws li Jekyll thiab plugins.
    • Cov neeg siv Windows: Nyeem phau ntawv qhia no kom tau Jekyll nce thiab khiav yam tsis muaj teeb meem.

Thaum ua tiav, koj yuav muaj peev xwm khiav ntau yam lus txib muab los ntawm kab hais kom ua.

Siv NPM scripts

Peb package.json suav nrog cov lus txib thiab cov haujlwm hauv qab no:

Ua haujlwm Kev piav qhia
npm run dist npm run disttsim cov /distdirectory nrog compiled ntaub ntawv. Siv Sass , Autoprefixer , thiab UglifyJS .
npm test Ib yam li npm run distntxiv rau nws khiav kev xeem hauv zos
npm run docs Tsim thiab lints CSS thiab JavaScript rau docs. Tom qab ntawd koj tuaj yeem khiav cov ntaub ntawv hauv zos ntawm npm run docs-serve.

Khiav npm runmus saib tag nrho npm scripts.

Autoprefixer

Bootstrap siv Autoprefixer (suav nrog hauv peb cov txheej txheem tsim) kom tau txais kev ntxiv cov neeg muag khoom ua ntej rau qee cov khoom CSS thaum tsim lub sijhawm. Ua li ntawd txuag peb lub sijhawm thiab cov lej los ntawm kev tso cai rau peb sau qhov tseem ceeb ntawm peb CSS ib zaug thaum tshem tawm qhov xav tau ntawm cov neeg muag khoom mixins zoo li cov pom hauv v3.

Peb tuav cov npe ntawm cov browsers txhawb nqa los ntawm Autoprefixer hauv cov ntaub ntawv sib cais hauv peb qhov chaw cia GitHub. Saib /package.json kom paub meej.

Cov ntaub ntawv hauv zos

Kev khiav peb cov ntaub ntawv hauv zos yuav tsum tau siv Jekyll, lub tshuab hluav taws xob hloov pauv hloov tau yooj yim uas muab rau peb: yooj yim suav nrog, Markdown-raws li cov ntaub ntawv, cov qauv, thiab ntau dua. Nov yog yuav ua li cas pib nws:

  1. Khiav los ntawm cov cuab yeej teeb tsa saum toj no rau nruab Jekyll (lub vev xaib tsim) thiab lwm yam Ruby dependencies nrog bundle install.
  2. Los ntawm lub hauv paus /bootstrapdirectory, khiav npm run docs-servehauv kab hais kom ua.
  3. Qhib http://localhost:9001koj lub browser, thiab voilà.

Kawm ntxiv txog kev siv Jekyll los ntawm kev nyeem nws cov ntaub ntawv .

Kev daws teeb meem

Yog tias koj ntsib teeb meem nrog kev txhim kho kev vam khom, tshem tawm tag nrho cov kev vam meej yav dhau los (ntiaj teb thiab hauv zos). Tom qab ntawd, rov ua dua npm install.