官术网_书友最值得收藏!

How to do it...

  1. Install bower using npm:
      npm install -g bower
  1. Verify the bower installation:
      which bower && bower -v
Note that both commands should return some values.
  1. Install Bootstrap 4 alpha 5 (this is not a typo!):
      bower install bootstrap#v4.0.0-alpha.5
We are installing an older version on purpose. This will be explained in the next steps.
  1. See the list of the installed dependencies:
      bower list

The preceding command will print out the status of your project's dependencies, including the available update to the currently installed Bootstrap 4 alpha 5.

  1. Initialize git in root:
      cd && cd workspace;
git init
  1. Stage the files into git's staging area:
      git add --all
  1. Commit the changes with a message:
      git commit -m “Add B4, alpha 5”
  1. Upgrade Bootstrap 4 to alpha 6 with bower:
      bower install bootstrap#v4.0.0-alpha.6
To install this update, Windows users will have to use the command prompt (rather than Git Bash for Windows).

When prompted for answer, type "2" and then press ENTER.
  1. Now, using git diff, we have at our fingertips the full view of changes that happened between alpha 5 and alpha 6 versions of Bootstrap 4. However, it is not feasible to simply use a blanket git diff command because too many changes are made to too many files between each version. A much better strategy is to use the git diff --stat, with the --stat flag giving us a nice overall idea of the changes, as well as which files had the most changes and which had the least. The following screenshot lists only the beginning of the output of the git diff --stat command, and does not include all the files affected, but it gives us a nice visual overview of changes made between alpha versions 5 and 6:
For Windows users, before listing the result of the git diff --stat command, Windows command prompt will throw a bunch of errors--just use the Page Down button to move past them. 
  1. Now we can inspect only the files that we are interested in, for example, the following command:
      git diff bower_components/bootstrap/scss/_alert.scss

The preceding command will show us the changes made only in the _alert.scss partial, between Bootstrap 4 Alpha 5 and Alpha 6 versions. In the following screenshot, we can see one of the changes made to this file:

  1. With this approach, it is also really simple to track the changes to the _alert.scss file in the previous versions of Bootstrap 4 alpha. For example, we can downgrade our Bootstrap 4 installation with the help of Bower, and then repeat our git diff for the _alert.scss file only, by running the following commands:
      bower install bootstrap#4.0.0-alpha.4
git diff bower_components/bootstrap/scss/_alert.scss

With this recipe, we are able to have complete, fine-grained control of observing the changes made to the framework through its versions. This is an amazing approach to understand the changes that occurred to specific components between different versions of the framework. It can help us understand why bugs occurred in our code, avoid pitfalls when working with legacy code, and learn the approaches taken by the Bootstrap contributors and how to better work with Sass in Bootstrap.

主站蜘蛛池模板: 台北市| 田阳县| 台安县| 托克托县| 攀枝花市| 保亭| 土默特左旗| 康定县| 沅江市| 吴川市| 永城市| 阳西县| 夏邑县| 萝北县| 格尔木市| 广河县| 峨眉山市| 岱山县| 明光市| 平武县| 枣强县| 凤山县| 方正县| 锡林浩特市| 达州市| 洛宁县| 平利县| 日照市| 汾西县| 尉犁县| 遂宁市| 大港区| 荣成市| 郁南县| 微博| 手游| 徐水县| 浮梁县| 封开县| 南阳市| 康乐县|