Skip to content

Instantly share code, notes, and snippets.

@nyordanov
Last active December 17, 2015 23:08
Show Gist options
  • Save nyordanov/5686673 to your computer and use it in GitHub Desktop.
Save nyordanov/5686673 to your computer and use it in GitHub Desktop.
Vamtam LESS Coding Guidelines

LESS Coding Guidelines

Example

.first-selector {
	position: absolute;
	left: 200px;
	top: 100px;
	width: 50px;

	.border-box();

	.child-1,
	.child-2 {
		> a {
			display: none;
		}

		&:hover {
			> a {
				display: inline;
			}
		}
	}
}

Indentation

  • Properties should be indentent with tabs.
  • Child selectors should be at the same level as the properties.
  • Opening brackets should be in the same line as the last selector.
  • Closing brackets should be at the same level as the selectors.
  • One closing bracket per line.

Properties

  • Always a single space after a property's colon.
  • End lines with a semi-colon.
  • Put regular properties first, then an empty line, then mixins.

Selectors

  • One selector per line.
  • Put a single empty line before the first selector unless this selector is on the first line of a block.
  • Attribute selectors, like input[type="text"] should always wrap the attribute's value in double quotes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment