in English

Fausia meafaigaluega

A'oa'o pe fa'apefea ona fa'aoga le Bootstrap's aofia ai npm scripts e fausia ai a tatou fa'amaumauga, tu'ufa'atasia le code source, su'e su'ega, ma isi mea.

Fa'atonuga meafaigaluega

Bootstrap faʻaoga npm scripts mo lona faʻaogaina faiga. O la matou package.json e aofia ai metotia talafeagai mo le galue ma le faʻavae, e aofia ai le tuʻufaʻatasia o code, suʻega faʻataʻitaʻiga, ma isi mea.

Mo le faʻaogaina o la matou faufale ma faʻatautaia a matou faʻamaumauga i le lotoifale, e te manaʻomia se kopi o faila faila a Bootstrap ma Node. Mulimuli i laasaga nei ma e tatau ona e sauni e lulu:

  1. Faʻapipiʻi ma faʻapipiʻi Node.js , lea matou te faʻaogaina e pulea ai a matou faʻalagolago.
  2. Po'o le siiina mai o puna'oa a Bootstrap po'o le tui le faleteuoloa a Bootstrap .
  3. Su'e i le root /bootstrapdirectory ma tamoe npm installe fa'apipi'i a matou fa'alagolago i le lotoifale o lo'o lisiina i totonu package.json .

A maeʻa, o le a mafai ona e faʻatautaia tulafono eseese o loʻo tuʻuina mai i le laina o le poloaiga.

Faʻaaogaina tusi npm

O la matou package.json e aofia ai tulafono ma galuega nei:

Galuega Fa'amatalaga
npm run dist npm run dist creates the /dist/ directory with compiled files. Uses Sass, Autoprefixer, and terser.
npm test Runs tests locally after running npm run dist
npm run docs-serve Builds and runs the documentation locally.

Run npm run to see all the npm scripts.

Get started with Bootstrap via npm with our starter project! Head to the twbs/bootstrap-npm-starter template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.

Sass

Bootstrap v4 uses Node Sass for compiling our Sass source files into CSS files (included in our build process). In order to end up with the same generated CSS when compiling Sass using your own asset pipeline, you’ll need to use a Sass compiler that supports at least the features that Node Sass does. This is important to note because as of October 26, 2020, LibSass and packages built on top of it—including Node Sass—are deprecated.

If you require newer Sass features or compatibility with newer CSS standards, Dart Sass is now the primary implementation of Sass and supports a JavaScript API that’s fully compatible with Node Sass (with a few exceptions listed on Dart Sass’s GitHub page).

We increase the Sass rounding precision to 6 (by default, it’s 5 in Node Sass) to prevent issues with browser rounding. If you use Dart Sass this won’t be something you need to adjust, as that compiler uses a rounding precision of 10 and for efficiency reasons does not allow it to be adjusted.

Autoprefixer

Bootstrap uses Autoprefixer (included in our build process) to automatically add vendor prefixes to some CSS properties at build time. Doing so saves us time and code by allowing us to write key parts of our CSS a single time while eliminating the need for vendor mixins like those found in v3.

We maintain the list of browsers supported through Autoprefixer in a separate file within our GitHub repository. See .browserslistrc for details.

Local documentation

O le faʻatautaia o matou faʻamaumauga i le lotoifale e manaʻomia ai le faʻaogaina o Hugo, lea e faʻapipiʻiina e ala i le hugo-bin npm package. O Hugo ose fa'atosina vave ma fa'alauteleina le fa'atupuina o nofoaga e maua mai ai ia i tatou: fa'avae e aofia ai, faila fa'avae Markdown, fa'ata'ita'iga, ma isi mea. O le auala lenei e amata ai:

  1. Faʻasaga i le seti meafaigaluega i luga e faʻapipiʻi uma faʻalagolago.
  2. Mai le root /bootstrapdirectory, tamoe npm run docs-servei le laina o le poloaiga.
  3. Tatala http://localhost:9001/i lau su'esu'ega, ma e leai.

Aʻoaʻo atili e uiga i le faʻaaogaina o Hugo e ala i le faitauina o ana faʻamaumauga .

Fa'afitauli

Afai e te feagai ma faʻafitauli i le faʻapipiʻiina o mea faʻalagolago, aveese uma lomiga faʻalagolago muamua (lalolagi ma le lotoifale). Ona toe fai lea npm install.