Skip to content

Instantly share code, notes, and snippets.

@kaelig
kaelig / readme.md
Created November 7, 2012 11:28
My coding conventions

CSS Coding Styleguide

  • Use 2 spaces for indentation
  • Avoid descendent selectors (.my-module p {…})
  • With Sass avoid nesting too deeply
  • Avoid attaching classes to elements (div.category {…})
  • Avoid !important !!!
  • Use percentages and box-sizing when possible
  • Rely on the component library
  • Try not to write any CSS if you can
@kaelig
kaelig / input.scss
Created November 21, 2012 22:41 — forked from blackfalcon/01_SassMeister.sass
Extending placeholder selectors within media queries
%myclass {
color: blue;
@media (min-width: 600px) {
background: red;
}
@media (min-width: 800px) {
font-size: 28px;
}
}
@kaelig
kaelig / SassMeister-input.scss
Created November 21, 2012 22:45
Generated by SassMeister.com, the Sass playground.
// Sass v3.2.3
test {
margin: 0;
}
@kaelig
kaelig / _grid.scss
Created November 27, 2012 12:38
Responsive News Grid system
$bootstrap: false !default;
$scaffold: true !default; // Output .span-n classes?
$selector-type: if($scaffold, ".", "%") !default;
$old-ie: false !default;
$total-columns: 12 !default;
$gutter: 8px !default;
$container-width: 100% !default;
$min-width: 240px !default;
@kaelig
kaelig / _icons.scss
Created November 28, 2012 10:19 — forked from chriseppstein/_icons.scss
This is an example of the generated stylesheet by compass for a set of sprites
@import "compass/utilities/sprites/base";
// General Sprite Defaults
// You can override them before you import this file.
$icon-sprite-base-class: ".icon-sprite" !default;
$icon-sprite-dimensions: false !default;
$icon-position: 0% !default;
$icon-spacing: 0 !default;
$icon-repeat: no-repeat !default;
@kaelig
kaelig / README.md
Created November 28, 2012 11:10
HiDPI sprites with Compass
@kaelig
kaelig / .ackrc
Last active June 13, 2016 17:38
Ack for front-enders
# ~/.ackrc
--type-add=ruby=.haml
--type-add=php=.phtml
--type-set=tpl=.jsx
--type-add=js=.jsx,.js
--type-set=less=.less
--type-set=sass=.scss,.sass
--type-set=scss=.scss,.sass
@kaelig
kaelig / dabblet.css
Created February 7, 2013 20:10
Buttons Test: input, a, button
/**
* Buttons Test: input, a, button
*/
input::-moz-focus-inner,
button::-moz-focus-inner {
border: 0;
padding: 0;
}
a {

Why Compass?

TL;DR: I definitevely don't have anything against Bourbon, and we can actually use it with Compass (Bourbon for most CSS3 and Compass for utilities, spriting, compilation & other functions). But not using Compass is missing a big advantage Sass has over LESS.

First, why NOT Compass

  • Doesn't work with libsass (yet — I read they plan on supporting libsass, probably later this year)
  • needs Ruby (for now), and installs the chunky_png gem
  • Slow compilation (because parsing image sizes, assembling sprites… actually takes time)
@kaelig
kaelig / textexposed.css
Last active December 16, 2015 13:38
Expose/hide content à la Facebook.
/* ==========================================================================
Text exposed utility
========================================================================== */
/**
* Hides/shows text (use case: "read more" link)
*
* When `u-textExposed` has class `u-textExposed--expose`:
* Shows `u-textExposed-show`
* Hides `u-textExposed-hide`