PageRenderTime 26ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/extend.html

https://bitbucket.org/burnsjeremy/bootstrap
HTML | 286 lines | 217 code | 46 blank | 23 comment | 0 complexity | e14b6d39f804c96649090d6c69904d0f MD5 | raw file
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Extend · Twitter Bootstrap</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <!-- Le styles -->
  10. <link href="assets/css/bootstrap.css" rel="stylesheet">
  11. <link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
  12. <link href="assets/css/docs.css" rel="stylesheet">
  13. <link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
  14. <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
  15. <!--[if lt IE 9]>
  16. <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  17. <![endif]-->
  18. <!-- Le fav and touch icons -->
  19. <link rel="shortcut icon" href="assets/ico/favicon.ico">
  20. <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
  21. <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
  22. <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
  23. <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
  24. </head>
  25. <body data-spy="scroll" data-target=".bs-docs-sidebar">
  26. <!-- Navbar
  27. ================================================== -->
  28. <div class="navbar navbar-inverse navbar-fixed-top">
  29. <div class="navbar-inner">
  30. <div class="container">
  31. <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  32. <span class="icon-bar"></span>
  33. <span class="icon-bar"></span>
  34. <span class="icon-bar"></span>
  35. </button>
  36. <a class="brand" href="./index.html">Bootstrap</a>
  37. <div class="nav-collapse collapse">
  38. <ul class="nav">
  39. <li class="">
  40. <a href="./index.html">Home</a>
  41. </li>
  42. <li class="">
  43. <a href="./getting-started.html">Get started</a>
  44. </li>
  45. <li class="">
  46. <a href="./scaffolding.html">Scaffolding</a>
  47. </li>
  48. <li class="">
  49. <a href="./base-css.html">Base CSS</a>
  50. </li>
  51. <li class="">
  52. <a href="./components.html">Components</a>
  53. </li>
  54. <li class="">
  55. <a href="./javascript.html">Javascript</a>
  56. </li>
  57. <li class="">
  58. <a href="./customize.html">Customize</a>
  59. </li>
  60. </ul>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <!-- Subhead
  66. ================================================== -->
  67. <header class="jumbotron subhead" id="overview">
  68. <div class="container">
  69. <h1>Extending Bootstrap</h1>
  70. <p class="lead">Extend Bootstrap to take advantage of included styles and components, as well as LESS variables and mixins.</p>
  71. <div>
  72. </header>
  73. <div class="container">
  74. <!-- Docs nav
  75. ================================================== -->
  76. <div class="row">
  77. <div class="span3 bs-docs-sidebar">
  78. <ul class="nav nav-list bs-docs-sidenav">
  79. <li><a href="#built-with-less"><i class="icon-chevron-right"></i> Built with LESS</a></li>
  80. <li><a href="#compiling"><i class="icon-chevron-right"></i> Compiling Bootstrap</a></li>
  81. <li><a href="#static-assets"><i class="icon-chevron-right"></i> Use as static assets</a></li>
  82. </ul>
  83. </div>
  84. <div class="span9">
  85. <!-- BUILT WITH LESS
  86. ================================================== -->
  87. <section id="built-with-less">
  88. <div class="page-header">
  89. <h1>Built with LESS</h1>
  90. </div>
  91. <img style="float: right; height: 36px; margin: 10px 20px 20px" src="assets/img/less-logo-large.png" alt="LESS CSS">
  92. <p class="lead">Bootstrap is made with LESS at its core, a dynamic stylesheet language created by our good friend, <a href="http://cloudhead.io">Alexis Sellier</a>. It makes developing systems-based CSS faster, easier, and more fun.</p>
  93. <h3>Why LESS?</h3>
  94. <p>One of Bootstrap's creators wrote a quick <a href="http://www.wordsbyf.at/2012/03/08/why-less/">blog post about this</a>, summarized here:</p>
  95. <ul>
  96. <li>Bootstrap compiles faster ~6x faster with Less compared to Sass</li>
  97. <li>Less is written in JavaScript, making it easier to us to dive in and patch compared to Ruby with Sass.</li>
  98. <li>Less is more; we want to feel like we're writing CSS and making Bootstrap approachable to all.</li>
  99. </ul>
  100. <h3>What's included?</h3>
  101. <p>As an extension of CSS, LESS includes variables, mixins for reusable snippets of code, operations for simple math, nesting, and even color functions.</p>
  102. <h3>Learn more</h3>
  103. <p>Visit the official website at <a href="http://lesscss.org">http://lesscss.org</a> to learn more.</p>
  104. </section>
  105. <!-- COMPILING LESS AND BOOTSTRAP
  106. ================================================== -->
  107. <section id="compiling">
  108. <div class="page-header">
  109. <h1>Compiling Bootstrap with Less</h1>
  110. </div>
  111. <p class="lead">Since our CSS is written with Less and utilizes variables and mixins, it needs to be compiled for final production implementation. Here's how.</p>
  112. <div class="alert alert-info">
  113. <strong>Note:</strong> If you're submitting a pull request to GitHub with modified CSS, you <strong>must</strong> recompile the CSS via any of these methods.
  114. </div>
  115. <h2>Tools for compiling</h2>
  116. <h3>Node with makefile</h3>
  117. <p>Install the LESS command line compiler, JSHint, Recess, and uglify-js globally with npm by running the following command:</p>
  118. <pre>$ npm install -g less jshint recess uglify-js</pre>
  119. <p>Once installed just run <code>make</code> from the root of your bootstrap directory and you're all set.</p>
  120. <p>Additionally, if you have <a href="https://github.com/mynyml/watchr">watchr</a> installed, you may run <code>make watch</code> to have bootstrap automatically rebuilt every time you edit a file in the bootstrap lib (this isn't required, just a convenience method).</p>
  121. <h3>Command line</h3>
  122. <p>Install the LESS command line tool via Node and run the following command:</p>
  123. <pre>$ lessc ./less/bootstrap.less > bootstrap.css</pre>
  124. <p>Be sure to include <code>--compress</code> in that command if you're trying to save some bytes!</p>
  125. <h3>Javascript</h3>
  126. <p><a href="http://lesscss.org/">Download the latest Less.js</a> and include the path to it (and Bootstrap) in the <code>&lt;head&gt;</code>.</p>
  127. <pre class="prettyprint">
  128. &lt;link rel="stylesheet/less" href="/path/to/bootstrap.less"&gt;
  129. &lt;script src="/path/to/less.js"&gt;&lt;/script&gt;
  130. </pre>
  131. <p>To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.</p>
  132. <h3>Unofficial Mac app</h3>
  133. <p><a href="http://incident57.com/less/">The unofficial Mac app</a> watches directories of .less files and compiles the code to local files after every save of a watched .less file. If you like, you can toggle preferences in the app for automatic minifying and which directory the compiled files end up in.</p>
  134. <h3>More apps</h3>
  135. <h4><a href="http://crunchapp.net/" target="_blank">Crunch</a></h4>
  136. <p>Crunch is a great looking LESS editor and compiler built on Adobe Air.</p>
  137. <h4><a href="http://incident57.com/codekit/" target="_blank">CodeKit</a></h4>
  138. <p>Created by the same guy as the unofficial Mac app, CodeKit is a Mac app that compiles LESS, SASS, Stylus, and CoffeeScript.</p>
  139. <h4><a href="http://wearekiss.com/simpless" target="_blank">Simpless</a></h4>
  140. <p>Mac, Linux, and Windows app for drag and drop compiling of LESS files. Plus, the <a href="https://github.com/Paratron/SimpLESS" target="_blank">source code is on GitHub</a>.</p>
  141. </section>
  142. <!-- Static assets
  143. ================================================== -->
  144. <section id="static-assets">
  145. <div class="page-header">
  146. <h1>Use as static assets</h1>
  147. </div>
  148. <p class="lead"><a href="./getting-started.html">Quickly start</a> any web project by dropping in the compiled or minified CSS and JS. Layer on custom styles separately for easy upgrades and maintenance moving forward.</p>
  149. <h3>Setup file structure</h3>
  150. <p>Download the latest compiled Bootstrap and place into your project. For example, you might have something like this:</p>
  151. <pre class="prettyprint">
  152. app/
  153. layouts/
  154. templates/
  155. public/
  156. css/
  157. bootstrap.min.css
  158. js/
  159. bootstrap.min.js
  160. img/
  161. glyphicons-halflings.png
  162. glyphicons-halflings-white.png
  163. </pre>
  164. <h3>Utilize starter template</h3>
  165. <p>Copy the following base HTML to get started.</p>
  166. <pre class="prettyprint linenums">
  167. &lt;html&gt;
  168. &lt;head&gt;
  169. &lt;title&gt;Bootstrap 101 Template&lt;/title&gt;
  170. &lt;!-- Bootstrap --&gt;
  171. &lt;link href="public/css/bootstrap.min.css" rel="stylesheet"&gt;
  172. &lt;/head&gt;
  173. &lt;body&gt;
  174. &lt;h1&gt;Hello, world!&lt;/h1&gt;
  175. &lt;!-- Bootstrap --&gt;
  176. &lt;script src="public/js/bootstrap.min.js"&gt;&lt;/script&gt;
  177. &lt;/body&gt;
  178. &lt;/html&gt;
  179. </pre>
  180. <h3>Layer on custom code</h3>
  181. <p>Work in your custom CSS, JS, and more as necessary to make Bootstrap your own with your own separate CSS and JS files.</p>
  182. <pre class="prettyprint linenums">
  183. &lt;html&gt;
  184. &lt;head&gt;
  185. &lt;title&gt;Bootstrap 101 Template&lt;/title&gt;
  186. &lt;!-- Bootstrap --&gt;
  187. &lt;link href="public/css/bootstrap.min.css" rel="stylesheet"&gt;
  188. &lt;!-- Project --&gt;
  189. &lt;link href="public/css/application.css" rel="stylesheet"&gt;
  190. &lt;/head&gt;
  191. &lt;body&gt;
  192. &lt;h1&gt;Hello, world!&lt;/h1&gt;
  193. &lt;!-- Bootstrap --&gt;
  194. &lt;script src="public/js/bootstrap.min.js"&gt;&lt;/script&gt;
  195. &lt;!-- Project --&gt;
  196. &lt;script src="public/js/application.js"&gt;&lt;/script&gt;
  197. &lt;/body&gt;
  198. &lt;/html&gt;
  199. </pre>
  200. </section>
  201. </div>
  202. </div>
  203. </div>
  204. <!-- Footer
  205. ================================================== -->
  206. <footer class="footer">
  207. <div class="container">
  208. <p class="pull-right"><a href="#">Back to top</a></p>
  209. <p>Designed and built with all the love in the world <a href="http://twitter.com/twitter" target="_blank">@twitter</a> by <a href="http://twitter.com/mdo" target="_blank">@mdo</a> and <a href="http://twitter.com/fat" target="_blank">@fat</a>.</p>
  210. <p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
  211. <p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
  212. <ul class="footer-links">
  213. <li><a href="http://blog.getbootstrap.com">Read the blog</a></li>
  214. <li><a href="https://github.com/twitter/bootstrap/issues?state=open">Submit issues</a></li>
  215. <li><a href="https://github.com/twitter/bootstrap/wiki">Roadmap and changelog</a></li>
  216. </ul>
  217. </div>
  218. </footer>
  219. <!-- Le javascript
  220. ================================================== -->
  221. <!-- Placed at the end of the document so the pages load faster -->
  222. <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
  223. <script src="assets/js/jquery.js"></script>
  224. <script src="assets/js/google-code-prettify/prettify.js"></script>
  225. <script src="assets/js/bootstrap-transition.js"></script>
  226. <script src="assets/js/bootstrap-alert.js"></script>
  227. <script src="assets/js/bootstrap-modal.js"></script>
  228. <script src="assets/js/bootstrap-dropdown.js"></script>
  229. <script src="assets/js/bootstrap-scrollspy.js"></script>
  230. <script src="assets/js/bootstrap-tab.js"></script>
  231. <script src="assets/js/bootstrap-tooltip.js"></script>
  232. <script src="assets/js/bootstrap-popover.js"></script>
  233. <script src="assets/js/bootstrap-button.js"></script>
  234. <script src="assets/js/bootstrap-collapse.js"></script>
  235. <script src="assets/js/bootstrap-carousel.js"></script>
  236. <script src="assets/js/bootstrap-typeahead.js"></script>
  237. <script src="assets/js/bootstrap-affix.js"></script>
  238. <script src="assets/js/application.js"></script>
  239. </body>
  240. </html>