Source

បង្កើតឧបករណ៍

ស្វែងយល់ពីរបៀបប្រើប្រាស់ស្គ្រីប npm ដែលរួមបញ្ចូលរបស់ Bootstrap ដើម្បីបង្កើតឯកសាររបស់យើង ចងក្រងកូដប្រភព ដំណើរការសាកល្បង និងច្រើនទៀត។

ការដំឡើងឧបករណ៍

Bootstrap ប្រើ អក្សរ npm សម្រាប់ប្រព័ន្ធបង្កើតរបស់វា។ package.json របស់យើង រួមបញ្ចូលវិធីសាស្រ្តងាយស្រួលសម្រាប់ធ្វើការជាមួយក្របខ័ណ្ឌ រួមទាំងការចងក្រងកូដ ការធ្វើតេស្តដែលកំពុងដំណើរការ និងច្រើនទៀត។

ដើម្បីប្រើប្រព័ន្ធបង្កើតរបស់យើង និងដំណើរការឯកសាររបស់យើងក្នុងមូលដ្ឋាន អ្នកនឹងត្រូវការច្បាប់ចម្លងនៃឯកសារប្រភព និង Node របស់ Bootstrap ។ អនុវត្តតាមជំហានទាំងនេះ ហើយអ្នកគួរតែត្រៀមខ្លួនដើម្បីរញ្ជួយ៖

  1. ទាញយក និងដំឡើង Node.js ដែលយើងប្រើដើម្បីគ្រប់គ្រងភាពអាស្រ័យរបស់យើង។
  2. រុករកទៅ /bootstrapថត root ហើយរត់ npm installដើម្បីដំឡើងភាពអាស្រ័យក្នុងតំបន់របស់យើងដែលបានរាយក្នុង package.json
  3. ដំឡើង Ruby ដំឡើង Bundler ជាមួយ gem install bundlerហើយចុងក្រោយដំណើរការ bundle install. វានឹងដំឡើងភាពអាស្រ័យ Ruby ទាំងអស់ដូចជា Jekyll និងកម្មវិធីជំនួយ។
    • អ្នក​ប្រើ Windows៖ អាន ​ការណែនាំ​នេះ ​ដើម្បី​ឱ្យ Jekyll ដំណើរការ​ដោយ​គ្មាន​បញ្ហា។

នៅពេលបញ្ចប់ អ្នកនឹងអាចដំណើរការពាក្យបញ្ជាផ្សេងៗដែលបានផ្តល់ពីបន្ទាត់ពាក្យបញ្ជា។

ដោយប្រើអក្សរ npm

Our package.json includes the following commands and tasks:

Task Description
npm run dist npm run dist creates the /dist/ directory with compiled files. Uses Sass, Autoprefixer, and UglifyJS.
npm test Same as npm run dist plus it runs tests locally
npm run docs Builds and lints CSS and JavaScript for docs. You can then run the documentation locally via npm run docs-serve.

Run npm run to see all the npm scripts.

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

Running our documentation locally requires the use of Jekyll, a decently flexible static site generator that provides us: basic includes, Markdown-based files, templates, and more. Here’s how to get it started:

  1. Run through the tooling setup above to install Jekyll (the site builder) and other Ruby dependencies with bundle install.
  2. From the root /bootstrap directory, run npm run docs-serve in the command line.
  3. Open http://localhost:9001 in your browser, and voilà.

Learn more about using Jekyll by reading its documentation.

Troubleshooting

Should you encounter problems with installing dependencies, uninstall all previous dependency versions (global and local). Then, rerun npm install.