Many developers working on front-end code introduces a lot of challenges.
Teammates understood Javascript best practices.
CSS? Another story.
Our biggest tool of success was to set guidelines.
These guidelines I will carry on to other projects.
Sharing is caring and I'd like to share the knowledge.
CSS is code too! Make it reusable and consistent.
.super-stylish {
color: purple;
font-family: 'Helvetica Neue', sans-serif;
font-size: 1em;
padding-bottom: .8em;
}
.plain-and-simple {
color: black;
font-family: 'Helvetica Neue', sans-serif;
font-size: 1em;
}
p {
font-family: 'Helvetica Neue', sans-serif;
font-size: 1em;
}
.super-stylish {
color: purple;
padding-bottom: .8em;
}
.plain-and-simple {
color: darkgray;
}
https://flic.kr/p/7Ai8hs
HTML tags that have meaning.
Great for accessibility.
Human readable.
<div id="navigation">
<a href="/login">Login</a>
</div>
<div>
<h1>Hi</h1>
</div>
<div>Content</div>
<div id="footer"></div>
<header>Hi</header>
<nav>
<a>Login</a>
</nav>
<article>Content</article>
<footer></footer>
#unique-button {
// can only be used to select ONE
}
p.short-description {
// selector requires a paragraph element
}
.navigation { // main component
font: 16px Helvetica, sans-serif;
margin-top: 0px;
margin-bottom: 20px;
}
.navigation--link { // sub component
color: #68d6a7;
font-size: 0.8em;
}
.navigation--link__disabled { // state
background-color: #6F6F6F;
color: #262626;
cursor: default;
}
<nav class="navigation">
<ul>
<li>
<a href="/home" class="navigation navigation--link">Home</a>
</li>
<li>
<a href="/v2" class="navigation navigation--link__disabled">Beta Feature!</a>
</li>
</ul>
</nav>
de exito!
Syntactically awesome stylesheets
Sass is preprocessed CSS that introduces
Variables
Functions
Nesting
Reusability++
// Variables
$green: #68d6a7;
$gray: #6F6F6F;
$dark-gray: #262626;
$default-link-color: $green;
$default-font: 16px "Open Sans", Helvetica, sans-serif;
$small-font-size: 0.8em;
// Nesting
.navigation { // main component
font: $default-font;
margin-top: 0px;
margin-bottom: 20px;
&--link { // sub component
color: $default-link-color;
font-size: $small-font-size;
&__disabled { // state
background-color: $gray;
color: $dark-gray;
}
}
}
.navigation { // main component
font: 16px Helvetica, sans-serif;
margin-top: 0px;
margin-bottom: 20px;
}
.navigation--link { // sub component
color: #68d6a7;
font-size: 0.8em;
}
.navigation--link__disabled { // state
background-color: #6F6F6F;
color: #262626;
cursor: default;
}
Unfortunately...
It was about the people and sustainability of our process.