Skip to content

Instantly share code, notes, and snippets.

@strann
strann / css-diff-patch-theme.js
Last active September 11, 2015 03:33
Saving an idea for diffing two CSS files, creating a patch and outputting a new file with only the changes
#! /usr/bin/env node
var fs = require('fs');
var jsdiff = require('diff');
var args = process.argv;
var fileTypeRgxp = /\.css$/;
var files = [];
var diff;
var patch;
@strann
strann / 00-requirements.md
Last active August 29, 2015 13:58
Markup structure for a flexible navigation component.

Requirements:

  • Every sub navigation must have a depth class: nav--depthN
  • The container and each <ul> must support arbitrary class names to be passed to the component from the CMS.
  • Each nav__item should get an additional class corresponding to its text node, for example:
    • <li class="nav__item">Example</li> ---> <li class="nav__item nav__item--example">Example</li>
  • The current node gets a class of nav_item--self
    • If the current node is a child node deeper than nav--depth0 then the node's root list item gets a class of nav_item--current

Notes:

@strann
strann / SassMeister-input.scss
Created March 31, 2014 19:45
An example of bad coding practice - deeply nested Sass leading to over-qualified CSS.
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
// This code sucks.
.module-container {
background-color: red;
@strann
strann / SASS-media-query-mixin.markdown
Last active December 23, 2015 21:19
A Pen by Stuart Trann.

SASS media query mixin

Allows for loose syntax media queries with predefined breakpoints or custom, on the fly ones. Defaults to only screen and min-width, allows for those to be overridden. Can be expanded more.

Sept. 11, 2013 - Updated to include chained media queries, ie:

@media only screen and (min-width: 500px) and (max-width: 600px){}

A Pen by Stuart Trann on CodePen.

@strann
strann / CSScomb Alphabetical order
Created November 29, 2012 21:00 — forked from evalica/CSScomb Alphabetical order
See CSScomb (http://csscomb.com/) for more details. Alphabetical order can be used by replacing $default_sort_order variable in "/Sublime Text 2/Packages/CSScomb/csscomb/libs/csscomb.php" with the following code:
$default_sort_order = '[
"-webkit-animation",
"-moz-animation",
"-ms-animation",
"-o-animation",
"animation",
"-webkit-animation-delay",
"-moz-animation-delay",
"-ms-animation-delay",
"-o-animation-delay",