|
| 1 | +<!-- Subhead |
| 2 | +================================================== --> |
| 3 | +<header class="jumbotron subhead" id="overview"> |
| 4 | + <div class="container"> |
| 5 | + <h1>{{_i}}Extending Bootstrap{{/i}}</h1> |
| 6 | + <p class="lead">{{_i}}Extend Bootstrap to take advantage of included styles and components, as well as LESS variables and mixins.{{/i}}</p> |
| 7 | + <div> |
| 8 | +</header> |
| 9 | + |
| 10 | + <div class="container"> |
| 11 | + |
| 12 | + <!-- Docs nav |
| 13 | + ================================================== --> |
| 14 | + <div class="row"> |
| 15 | + <div class="span3 bs-docs-sidebar"> |
| 16 | + <ul class="nav nav-list bs-docs-sidenav"> |
| 17 | + <li><a href="#built-with-less"><i class="icon-chevron-right"></i> {{_i}}Built with LESS{{/i}}</a></li> |
| 18 | + <li><a href="#compiling"><i class="icon-chevron-right"></i> {{_i}}Compiling Bootstrap{{/i}}</a></li> |
| 19 | + <li><a href="#static-assets"><i class="icon-chevron-right"></i> {{_i}}Use as static assets{{/i}}</a></li> |
| 20 | + </ul> |
| 21 | + </div> |
| 22 | + <div class="span9"> |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + <!-- BUILT WITH LESS |
| 27 | + ================================================== --> |
| 28 | + <section id="built-with-less"> |
| 29 | + <div class="page-header"> |
| 30 | + <h1>{{_i}}Built with LESS{{/i}}</h1> |
| 31 | + </div> |
| 32 | + |
| 33 | + <img style="float: right; height: 36px; margin: 10px 20px 20px" src="assets/img/less-logo-large.png" alt="LESS CSS"> |
| 34 | + <p class="lead">{{_i}}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.{{/i}}</p> |
| 35 | + |
| 36 | + <h3>{{_i}}Why LESS?{{/i}}</h3> |
| 37 | + <p>{{_i}}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:{{/i}}</p> |
| 38 | + <ul> |
| 39 | + <li>{{_i}}Bootstrap compiles faster ~6x faster with Less compared to Sass{{/i}}</li> |
| 40 | + <li>{{_i}}Less is written in JavaScript, making it easier to us to dive in and patch compared to Ruby with Sass.{{/i}}</li> |
| 41 | + <li>{{_i}}Less is more; we want to feel like we're writing CSS and making Bootstrap approachable to all.{{/i}}</li> |
| 42 | + </ul> |
| 43 | + |
| 44 | + <h3>{{_i}}What's included?{{/i}}</h3> |
| 45 | + <p>{{_i}}As an extension of CSS, LESS includes variables, mixins for reusable snippets of code, operations for simple math, nesting, and even color functions.{{/i}}</p> |
| 46 | + |
| 47 | + <h3>{{_i}}Learn more{{/i}}</h3> |
| 48 | + <p>{{_i}}Visit the official website at <a href="http://lesscss.org">http://lesscss.org</a> to learn more.{{/i}}</p> |
| 49 | + </section> |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + <!-- COMPILING LESS AND BOOTSTRAP |
| 54 | + ================================================== --> |
| 55 | + <section id="compiling"> |
| 56 | + <div class="page-header"> |
| 57 | + <h1>{{_i}}Compiling Bootstrap with Less{{/i}}</h1> |
| 58 | + </div> |
| 59 | + |
| 60 | + <p class="lead">{{_i}}Since our CSS is written with Less and utilizes variables and mixins, it needs to be compiled for final production implementation. Here's how.{{/i}}</p> |
| 61 | + |
| 62 | + <div class="alert alert-info"> |
| 63 | + {{_i}}<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.{{/i}} |
| 64 | + </div> |
| 65 | + |
| 66 | + <h2>{{_i}}Tools for compiling{{/i}}</h2> |
| 67 | + |
| 68 | + <h3>{{_i}}Command line{{/i}}</h3> |
| 69 | + <p>{{_i}}Follow <a href="https://github.com/twbs/bootstrap#developers">the instructions in the project readme</a> on GitHub for compiling via command line.{{/i}}</p> |
| 70 | + |
| 71 | + <h3>{{_i}}JavaScript{{/i}}</h3> |
| 72 | + <p>{{_i}}<a href="http://lesscss.org/">Download the latest Less.js</a> and include the path to it (and Bootstrap) in the <code><head></code>.{{/i}}</p> |
| 73 | +<pre class="prettyprint"> |
| 74 | +<link rel="stylesheet/less" href="/path/to/bootstrap.less"> |
| 75 | +<script src="/path/to/less.js"></script> |
| 76 | +</pre> |
| 77 | + <p>{{_i}}To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.{{/i}}</p> |
| 78 | + |
| 79 | + <h3>{{_i}}Unofficial Mac app{{/i}}</h3> |
| 80 | + <p>{{_i}}<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.{{/i}}</p> |
| 81 | + |
| 82 | + <h3>{{_i}}More apps{{/i}}</h3> |
| 83 | + <h4><a href="http://crunchapp.net/" target="_blank">Crunch</a></h4> |
| 84 | + <p>{{_i}}Crunch is a great looking LESS editor and compiler built on Adobe Air.{{/i}}</p> |
| 85 | + <h4><a href="http://incident57.com/codekit/" target="_blank">CodeKit</a></h4> |
| 86 | + <p>{{_i}}Created by the same guy as the unofficial Mac app, CodeKit is a Mac app that compiles LESS, SASS, Stylus, and CoffeeScript.{{/i}}</p> |
| 87 | + <h4><a href="http://wearekiss.com/simpless" target="_blank">Simpless</a></h4> |
| 88 | + <p>{{_i}}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>.{{/i}}</p> |
| 89 | + |
| 90 | + </section> |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + <!-- Static assets |
| 95 | + ================================================== --> |
| 96 | + <section id="static-assets"> |
| 97 | + <div class="page-header"> |
| 98 | + <h1>{{_i}}Use as static assets{{/i}}</h1> |
| 99 | + </div> |
| 100 | + <p class="lead">{{_i}}<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.{{/i}}</p> |
| 101 | + |
| 102 | + <h3>{{_i}}Setup file structure{{/i}}</h3> |
| 103 | + <p>{{_i}}Download the latest compiled Bootstrap and place into your project. For example, you might have something like this:{{/i}}</p> |
| 104 | +<pre> |
| 105 | + <span class="icon-folder-open"></span> app/ |
| 106 | + <span class="icon-folder-open"></span> layouts/ |
| 107 | + <span class="icon-folder-open"></span> templates/ |
| 108 | + <span class="icon-folder-open"></span> public/ |
| 109 | + <span class="icon-folder-open"></span> css/ |
| 110 | + <span class="icon-file"></span> bootstrap.min.css |
| 111 | + <span class="icon-folder-open"></span> js/ |
| 112 | + <span class="icon-file"></span> bootstrap.min.js |
| 113 | + <span class="icon-folder-open"></span> img/ |
| 114 | + <span class="icon-file"></span> glyphicons-halflings.png |
| 115 | + <span class="icon-file"></span> glyphicons-halflings-white.png |
| 116 | +</pre> |
| 117 | + |
| 118 | + <h3>{{_i}}Utilize starter template{{/i}}</h3> |
| 119 | + <p>{{_i}}Copy the following base HTML to get started.{{/i}}</p> |
| 120 | +<pre class="prettyprint linenums"> |
| 121 | +<html> |
| 122 | + <head> |
| 123 | + <title>Bootstrap 101 Template</title> |
| 124 | + <!-- Bootstrap --> |
| 125 | + <link href="public/css/bootstrap.min.css" rel="stylesheet"> |
| 126 | + </head> |
| 127 | + <body> |
| 128 | + <h1>Hello, world!</h1> |
| 129 | + <!-- Bootstrap --> |
| 130 | + <script src="public/js/bootstrap.min.js"></script> |
| 131 | + </body> |
| 132 | +</html> |
| 133 | +</pre> |
| 134 | + |
| 135 | + <h3>{{_i}}Layer on custom code{{/i}}</h3> |
| 136 | + <p>{{_i}}Work in your custom CSS, JS, and more as necessary to make Bootstrap your own with your own separate CSS and JS files.{{/i}}</p> |
| 137 | +<pre class="prettyprint linenums"> |
| 138 | +<html> |
| 139 | + <head> |
| 140 | + <title>Bootstrap 101 Template</title> |
| 141 | + <!-- Bootstrap --> |
| 142 | + <link href="public/css/bootstrap.min.css" rel="stylesheet"> |
| 143 | + <!-- Project --> |
| 144 | + <link href="public/css/application.css" rel="stylesheet"> |
| 145 | + </head> |
| 146 | + <body> |
| 147 | + <h1>Hello, world!</h1> |
| 148 | + <!-- Bootstrap --> |
| 149 | + <script src="public/js/bootstrap.min.js"></script> |
| 150 | + <!-- Project --> |
| 151 | + <script src="public/js/application.js"></script> |
| 152 | + </body> |
| 153 | +</html> |
| 154 | +</pre> |
| 155 | + |
| 156 | + </section> |
| 157 | + |
| 158 | + </div>{{! /span9 }} |
| 159 | + </div>{{! row}} |
| 160 | + |
| 161 | + </div>{{! /.container }} |
0 commit comments