2b2a7d67b6e1dd90d4452a8bc9dd1af29f283b60.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. # Contributing to Bootstrap
  2. Looking to contribute something to Bootstrap? **Here's how you can help.**
  3. Please take a moment to review this document in order to make the contribution
  4. process easy and effective for everyone involved.
  5. Following these guidelines helps to communicate that you respect the time of
  6. the developers managing and developing this open source project. In return,
  7. they should reciprocate that respect in addressing your issue or assessing
  8. patches and features.
  9. ## Using the issue tracker
  10. The [issue tracker](https://github.com/twbs/bootstrap/issues) is
  11. the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests)
  12. and [submitting pull requests](#pull-requests), but please respect the following
  13. restrictions:
  14. * Please **do not** use the issue tracker for personal support requests. Stack
  15. Overflow ([`twitter-bootstrap-3`](https://stackoverflow.com/questions/tagged/twitter-bootstrap-3) tag), [Slack](https://bootstrap-slack.herokuapp.com/) or [IRC](README.md#community) are better places to get help.
  16. * Please **do not** derail or troll issues. Keep the discussion on topic and
  17. respect the opinions of others.
  18. * Please **do not** open issues or pull requests regarding the code in
  19. [`Normalize`](https://github.com/necolas/normalize.css) (open them in
  20. their respective repositories).
  21. ## Issues and labels
  22. Our bug tracker utilizes several labels to help organize and identify issues. Here's what they represent and how we use them:
  23. - `browser bug` - Issues that are reported to us, but actually are the result of a browser-specific bug. These are diagnosed with reduced test cases and result in an issue opened on that browser's own bug tracker.
  24. - `confirmed` - Issues that have been confirmed with a reduced test case and identify a bug in Bootstrap.
  25. - `css` - Issues stemming from our compiled CSS or source Less files.
  26. - `docs` - Issues for improving or updating our documentation.
  27. - `examples` - Issues involving the example templates included in our docs.
  28. - `feature` - Issues asking for a new feature to be added, or an existing one to be extended or modified. New features require a minor version bump (e.g., `v3.0.0` to `v3.1.0`).
  29. - `grunt` - Issues with our included JavaScript-based Gruntfile, which is used to run all our tests, concatenate and compile source files, and more.
  30. - `help wanted` - Issues we need or would love help from the community to resolve.
  31. - `js` - Issues stemming from our compiled or source JavaScript files.
  32. - `meta` - Issues with the project itself or our GitHub repository.
  33. For a complete look at our labels, see the [project labels page](https://github.com/twbs/bootstrap/labels).
  34. ## Bug reports
  35. A bug is a _demonstrable problem_ that is caused by the code in the repository.
  36. Good bug reports are extremely helpful, so thanks!
  37. Guidelines for bug reports:
  38. 0. **Validate and lint your code** — [validate your HTML](http://html5.validator.nu)
  39. and [lint your HTML](https://github.com/twbs/bootlint) to ensure your
  40. problem isn't caused by a simple error in your own code.
  41. 1. **Use the GitHub issue search** — check if the issue has already been
  42. reported.
  43. 2. **Check if the issue has been fixed** — try to reproduce it using the
  44. latest `master` or development branch in the repository.
  45. 3. **Isolate the problem** — ideally create a [reduced test
  46. case](https://css-tricks.com/reduced-test-cases/) and a live example.
  47. [This JS Bin](http://jsbin.com/lefey/1/edit?html,output) is a helpful template.
  48. A good bug report shouldn't leave others needing to chase you up for more
  49. information. Please try to be as detailed as possible in your report. What is
  50. your environment? What steps will reproduce the issue? What browser(s) and OS
  51. experience the problem? Do other browsers show the bug differently? What
  52. would you expect to be the outcome? All these details will help people to fix
  53. any potential bugs.
  54. Example:
  55. > Short and descriptive example bug report title
  56. >
  57. > A summary of the issue and the browser/OS environment in which it occurs. If
  58. > suitable, include the steps required to reproduce the bug.
  59. >
  60. > 1. This is the first step
  61. > 2. This is the second step
  62. > 3. Further steps, etc.
  63. >
  64. > `<url>` - a link to the reduced test case
  65. >
  66. > Any other information you want to share that is relevant to the issue being
  67. > reported. This might include the lines of code that you have identified as
  68. > causing the bug, and potential solutions (and your opinions on their
  69. > merits).
  70. ### Reporting upstream browser bugs
  71. Sometimes bugs reported to us are actually caused by bugs in the browser(s) themselves, not bugs in Bootstrap per se.
  72. When feasible, we aim to report such upstream bugs to the relevant browser vendor(s), and then list them on our [Wall of Browser Bugs](http://getbootstrap.com/browser-bugs/) and [document them in MDN](https://developer.mozilla.org/en-US/docs/Web).
  73. | Vendor(s) | Browser(s) | Rendering engine | Bug reporting website(s) | Notes |
  74. | ------------- | ---------------------------- | ---------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------- |
  75. | Mozilla | Firefox | Gecko | https://bugzilla.mozilla.org/enter_bug.cgi | "Core" is normally the right product option to choose. |
  76. | Apple | Safari | WebKit | https://bugs.webkit.org/enter_bug.cgi?product=WebKit <br> https://bugreport.apple.com | In Apple's bug reporter, choose "Safari" as the product. |
  77. | Google, Opera | Chrome, Chromium, Opera v15+ | Blink | https://code.google.com/p/chromium/issues/list | Click the "New issue" button. |
  78. | Microsoft | Internet Explorer | Trident | https://connect.microsoft.com/IE/feedback/LoadSubmitFeedbackForm | |
  79. ### Issues bots
  80. [@twbs-lmvtfy](https://github.com/twbs-lmvtfy) is a Bootstrap bot that hangs out in our GitHub issue tracker and automatically checks for HTML validation errors in live examples (e.g. jsFiddles, JS Bins, Bootplys, Plunks, CodePens, etc.) posted in issue comments. If it finds any errors, it will post a follow-up comment on the issue and point out the errors. If this happens with an example you've posted, please fix the errors and post an updated live example. If you opened a bug report, please check whether the bug still occurs with your revised, valid live example. If the bug no longer occurs, it was probably due to your invalid HTML rather than something in Bootstrap and we'd appreciate it if you could close out the GitHub issue.
  81. ## Feature requests
  82. Feature requests are welcome. But take a moment to find out whether your idea
  83. fits with the scope and aims of the project. It's up to *you* to make a strong
  84. case to convince the project's developers of the merits of this feature. Please
  85. provide as much detail and context as possible.
  86. ## Pull requests
  87. Good pull requests—patches, improvements, new features—are a fantastic
  88. help. They should remain focused in scope and avoid containing unrelated
  89. commits.
  90. **Please ask first** before embarking on any significant pull request (e.g.
  91. implementing features, refactoring code, porting to a different language),
  92. otherwise you risk spending a lot of time working on something that the
  93. project's developers might not want to merge into the project.
  94. Please adhere to the [coding guidelines](#code-guidelines) used throughout the
  95. project (indentation, accurate comments, etc.) and any other requirements
  96. (such as test coverage).
  97. **Do not edit `bootstrap.css`, `bootstrap-theme.css`, or `bootstrap.js`
  98. directly!** Those files are automatically generated. You should edit the
  99. source files in [`/bootstrap/less/`](https://github.com/twbs/bootstrap/tree/master/less)
  100. and/or [`/bootstrap/js/`](https://github.com/twbs/bootstrap/tree/master/js) instead.
  101. Similarly, when contributing to Bootstrap's documentation, you should edit the
  102. documentation source files in
  103. [the `/bootstrap/docs/` directory of the `master` branch](https://github.com/twbs/bootstrap/tree/master/docs).
  104. **Do not edit the `gh-pages` branch.** That branch is generated from the
  105. documentation source files and is managed separately by the Bootstrap Core Team.
  106. Adhering to the following process is the best way to get your work
  107. included in the project:
  108. 1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
  109. and configure the remotes:
  110. ```bash
  111. # Clone your fork of the repo into the current directory
  112. git clone https://github.com/<your-username>/bootstrap.git
  113. # Navigate to the newly cloned directory
  114. cd bootstrap
  115. # Assign the original repo to a remote called "upstream"
  116. git remote add upstream https://github.com/twbs/bootstrap.git
  117. ```
  118. 2. If you cloned a while ago, get the latest changes from upstream:
  119. ```bash
  120. git checkout master
  121. git pull upstream master
  122. ```
  123. 3. Create a new topic branch (off the main project development branch) to
  124. contain your feature, change, or fix:
  125. ```bash
  126. git checkout -b <topic-branch-name>
  127. ```
  128. 4. Commit your changes in logical chunks. Please adhere to these [git commit
  129. message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
  130. or your code is unlikely be merged into the main project. Use Git's
  131. [interactive rebase](https://help.github.com/articles/interactive-rebase)
  132. feature to tidy up your commits before making them public.
  133. 5. Locally merge (or rebase) the upstream development branch into your topic branch:
  134. ```bash
  135. git pull [--rebase] upstream master
  136. ```
  137. 6. Push your topic branch up to your fork:
  138. ```bash
  139. git push origin <topic-branch-name>
  140. ```
  141. 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
  142. with a clear title and description against the `master` branch.
  143. **IMPORTANT**: By submitting a patch, you agree to allow the project owners to
  144. license your work under the terms of the [MIT License](LICENSE) (if it
  145. includes code changes) and under the terms of the
  146. [Creative Commons Attribution 3.0 Unported License](docs/LICENSE)
  147. (if it includes documentation changes).
  148. ### Pull request bots
  149. [@twbs-rorschach](https://github.com/twbs-rorschach) is a Bootstrap bot that hangs out in our GitHub issue tracker and automatically checks all pull requests for a few simple common mistakes. It's possible that Rorschach might leave a comment on your pull request and then close it. If that happens, simply fix the problem(s) mentioned in the comment (there should be link(s) in the comment explaining the problem(s) in detail) and then either:
  150. * Push the revised version to your pull request's branch and post a comment on the pull request saying that you've fixed the problem(s). One of the Bootstrap Core Team members will then come along and reopen your pull request.
  151. * Or you can just open a new pull request for your revised version.
  152. [@twbs-savage](https://github.com/twbs-savage) is a Bootstrap bot that automatically runs cross-browser tests (via [Sauce](https://saucelabs.com) and Travis CI) on JavaScript pull requests. Savage will leave a comment on pull requests stating whether cross-browser JS tests passed or failed, with a link to the full Travis build details. If your pull request fails, check the Travis log to see which browser + OS combinations failed. Each browser test in the Travis log includes a link to a Sauce page with details about the test. On those details pages, you can watch a screencast of the test run to see exactly which unit tests failed.
  153. ## Code guidelines
  154. ### HTML
  155. [Adhere to the Code Guide.](http://codeguide.co/#html)
  156. - Use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags).
  157. - Use CDNs and HTTPS for third-party JS when possible. We don't use protocol-relative URLs in this case because they break when viewing the page locally via `file://`.
  158. - Use [WAI-ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) attributes in documentation examples to promote accessibility.
  159. ### CSS
  160. [Adhere to the Code Guide.](http://codeguide.co/#css)
  161. - When feasible, default color palettes should comply with [WCAG color contrast guidelines](http://www.w3.org/TR/WCAG20/#visual-audio-contrast).
  162. - Except in rare cases, don't remove default `:focus` styles (via e.g. `outline: none;`) without providing alternative styles. See [this A11Y Project post](http://a11yproject.com/posts/never-remove-css-outlines/) for more details.
  163. ### JS
  164. - No semicolons (in client-side JS)
  165. - 2 spaces (no tabs)
  166. - strict mode
  167. - "Attractive"
  168. ### Checking coding style
  169. Run `grunt test` before committing to ensure your changes follow our coding standards.
  170. ## License
  171. By contributing your code, you agree to license your contribution under the [MIT License](LICENSE).
  172. By contributing to the documentation, you agree to license your contribution under the [Creative Commons Attribution 3.0 Unported License](docs/LICENSE).
  173. Prior to v3.1.0, Bootstrap's code was released under the Apache License v2.0.