3 ms·
The key to getting the most out of Bootstrap is to use the less modules. I created a fork of bootstrap where I setup the following: * boostrap files are in a
by nikcub 15y ago
The key to getting the most out of Bootstrap is to use the less modules.
I created a fork of bootstrap where I setup the following:
* boostrap files are in a subdir called 'boostrap'
* in the 'css' directory create a less file for each style sheet, for eg. site.less, admin.less
* in that site file, place all your variables and then include all the bootstrap files
* under that, put in all your custom CSS
* here is an example: https://gist.github.com/1356716 https://gist.github.com/1356716
* the top of the file is the contents of variables.less, then the includes, then custom CSS
* copy the Makefile into your 'css' folder, and edit it to change the right paths
* put your color theme (3, 4 o4 5 colors) at the top of the file and define them as variables. declare everything else (links, topbar etc.) as one of these colors or a lighter(), darker() etc. variation
* there are tons of online color matchin sites, including the excellent Adobe Kuler - pick a color theme and plug it into less
* learn how to use less: http://lesscss.org/ http://lesscss.org/
* instead of using span8, span14 etc. learn how to inherit in less. for eg. a sidebar 4 spans wide would be:
#sidebar {
..makeColumn(4)
}
* use macro's to create your own custom gradients, for eg.
.lightblue {
.gradientBar(#5bc0de, #339bb9);
}
* use those mixins to create custom button styles. for eg. to create a custom topbar fill using the lightblue:
.topbar.fill {
.box-shadow();
.lightBlue();
}
* also, I wrote another script that will autorefresh your browser in OSX when you save your less. so the combination of this makefile and this applescript will build the css file from less and refresh your browser whenever you save:
https://gist.github.com/1326820 https://gist.github.com/1326820
- ammmir 15y agogreat tips! auto reloading css is perhaps my most favorite timesaver. i add this snippet to a page when in development: <script> if(location.href.indexOf('file://') == 0 || location.href.indexOf('http://localhost') == 0) { var s = document.createElement('script'); s.async = true; s.src = 'js/css_auto-reload.js'; s.onload = function() { document.styleSheets.start_autoreload(1000); }; document.getElementsByTagName('head')[0].appendChild(s); } </script> it uses http://nv.github.com/css_auto-reload/ http://nv.github.com/css_auto-reload/ and updates the page (in place) nearly instantly after i save css in my editor. i use sassy/scss, so i also run "compass watch" in a terminal. it's css tweaking heaven for me :)
- tomvo 15y agocheck out LiveReload, does that plus auto compile.
- gerrit 15y agoIf youre using less.js, there's no need to write custom code to auto refresh the CSS, it has that feature built in: <link rel="stylesheet/less" href="/stylesheets/main.less" type="text/css" /> <script src="http://lesscss.googlecode.com/files/less-1.0.21.min.js></script> <script type="text/javascript" charset="utf-8"> less.env = "development"; less.watch(); </script>