2. About me
I'm Davide Di Pumpo and I'm a front-end developer.
I love graphic novel, competitive videogames and cats.
You can find me on the internet with the nickname
MakhBeth
- -Twitter GitHub LinkedIn
7. What is a guideline?
(a.k.a. code styleguide)
A styleguide is not just a pleasing document to read,
picturing an ideal state for your code. It is a key document
in a project’s life, describing how and why code should be
written.
Hugo Giraudel
8. Basically you have to choice if write something like that
var named = function named() {
return true;
};
or:
var named = function named() {return true};
10. A strong code design is more readable!
/* in a file far far away */
@mixin visually-hidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px; width: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
}
/* somewhere in your code */
.pippo {
@include visually-hidden();
}
.pluto {
@include visually-hidden;
}
11. A real example: Airbnb
// bad - unnecessary function call
function() {
var name = getName();
if (!arguments.length) {
return false;
}
this.setFirstName(name);
return true;
}
// good
function() {
var name;
if (!arguments.length) {
return false;
}
name = getName();
this.setFirstName(name);
return true;
}
12. So, why a guideline?
Let's see, with some cat examples!
Taken from 'sHarry Roberts CSS Guidelines