SlideShare una empresa de Scribd logo
1 de 281
Sass Why
for intro to Sass for CSSGuy
  An
     the CSS fans
CSS
IS
AWESOME
CSS
IS
AWESOME


          via stevenf.com
Syntactically
Syntactically
Awesome
Syntactically
Awesome
Style
Syntactically
Awesome
Style
Sheets
Sass
Sass
• CSS meta-language
Sass
• CSS meta-language
• Simpler, more elegant syntax for CSS
Sass
• CSS meta-language
• Simpler, more elegant syntax for CSS
• Helps to create manageable stylesheets
Sass
• CSS meta-language
• Simpler, more elegant syntax for CSS
• Helps to create manageable stylesheets
• An upgrade to CSS
Sass
• CSS meta-language
• Simpler, more elegant syntax for CSS
• Helps to create manageable stylesheets
• An upgrade to CSS

Sass makes CSS fun again.
Two delicious flavors
Sass                                 Sass & SCSS
• CSS meta-language
• Simpler, more elegant syntax for CSS
• Helps to create manageable stylesheets
• An upgrade to CSS

Sass makes CSS fun again.
• CSS authoring framework built in Sass
• CSS authoring framework built in Sass
• Collection of Sass mixins and functions
• CSS authoring framework built in Sass
• Collection of Sass mixins and functions
• Library of the web’s most reusable CSS patterns
• CSS authoring framework built in Sass
• Collection of Sass mixins and functions
• Library of the web’s most reusable CSS patterns
• Makes CSS3 easy
Two delicous flavors…
Two delicous flavors…
Sass and SCSS
Two delicous flavors…
Sass and SCSS
Two delicous flavors…
Sass and SCSS
• both functionally equivalent
Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
• neither will be deprecated
Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
• neither will be deprecated
• SCSS is not a successor to Sass
Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
• neither will be deprecated
• SCSS is not a successor to Sass
• each make different people happy
Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
• neither will be deprecated
• SCSS is not a successor to Sass
• each make different people happy
• some people like both
CSS
nav {
  background: #ccc;
  width: 500px;
  margin: 10px auto;
}
nav a {
  float: left;
  display: block;
  padding: 0 5px;
  color: #666;
}
nav a:hover {
  color: #000;
}
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;       nesting
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;       nesting
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;       nesting
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;       nesting
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }



 the parent selector
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;       nesting
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }



 the parent selector
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }


                       SCSS doesn’t care about whitespace
                       nav { width: 500px; margin: 10px auto;
                             background: #ccc;
                           a { float: left; display: block; padding: 0 5px;
                               color: #666;
                             &:hover { color: #000; }}}
CSS                    SCSS
nav {                  nav {
  background: #ccc;      background: #ccc;
  width: 500px;          width: 500px;
  margin: 10px auto;     margin: 10px auto;
}                        a {
nav a {                    float: left;
  float: left;             display: block;
  display: block;          padding: 0 5px;
  padding: 0 5px;          color: #666;
  color: #666;             &:hover {
}                            color: #000;
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS                   Sass
nav {                  nav {                  nav
  background: #ccc;      background: #ccc;      background: #ccc
  width: 500px;          width: 500px;          width: 500px
  margin: 10px auto;     margin: 10px auto;     margin: 10px auto
}                        a {                    a
nav a {                    float: left;           float: left
  float: left;             display: block;        display: block
  display: block;          padding: 0 5px;        padding: 0 5px
  padding: 0 5px;          color: #666;           color: #666
  color: #666;             &:hover {              &:hover
}                            color: #000;           color: #000
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS                   Sass
nav {                  nav {                  nav
  background: #ccc;      background: #ccc;      background: #ccc
  width: 500px;          width: 500px;          width: 500px
  margin: 10px auto;     margin: 10px auto;     margin: 10px auto
}                        a {                    a
nav a {                    float: left;           float: left
  float: left;             display: block;        display: block
  display: block;          padding: 0 5px;        padding: 0 5px
  padding: 0 5px;          color: #666;           color: #666
  color: #666;             &:hover {              &:hover
}                            color: #000;           color: #000
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS                   Sass
nav {                  nav {                  nav
  background: #ccc;      background: #ccc;      background: #ccc
  width: 500px;          width: 500px;          width: 500px
  margin: 10px auto;     margin: 10px auto;     margin: 10px auto
}                        a {                    a
nav a {                    float: left;           float: left
  float: left;             display: block;        display: block
  display: block;          padding: 0 5px;        padding: 0 5px
  padding: 0 5px;          color: #666;           color: #666
  color: #666;             &:hover {              &:hover
}                            color: #000;           color: #000
nav a:hover {              }
  color: #000;           }
}                      }
CSS                    SCSS                   Sass
nav {                  nav {                  nav
  background: #ccc;      background: #ccc;      background: #ccc
  width: 500px;          width: 500px;          width: 500px
  margin: 10px auto;     margin: 10px auto;     margin: 10px auto
}                        a {                    a
nav a {                    float: left;           float: left
  float: left;             display: block;        display: block
  display: block;          padding: 0 5px;        padding: 0 5px
  padding: 0 5px;          color: #666;           color: #666
  color: #666;             &:hover {              &:hover
}                            color: #000;           color: #000
nav a:hover {              }
  color: #000;           }
}                      }
Advantages of each…
SCSS              Sass
Advantages of each…
SCSS                   Sass
• the “newer” syntax
Advantages of each…
SCSS                   Sass
• the “newer” syntax
• a super set of CSS
Advantages of each…
SCSS                    Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
Advantages of each…
SCSS                     Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
Advantages of each…
SCSS                             Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
Advantages of each…
SCSS                             Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
Advantages of each…
SCSS                                 Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
Advantages of each…
SCSS                                    Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
Advantages of each…
SCSS                                    Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
Advantages of each…
SCSS                                    Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS                     • white-space aware
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS                     • white-space aware
• very similar to CSS                    • shortcuts for @mixin and @include
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS                     • white-space aware
• very similar to CSS                    • shortcuts for @mixin and @include
• low barrier to entry                   • more scannable
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS                     • white-space aware
• very similar to CSS                    • shortcuts for @mixin and @include
• low barrier to entry                   • more scannable
• allows for single-line rules           • more concise, better for teams
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS                     • white-space aware
• very similar to CSS                    • shortcuts for @mixin and @include
• low barrier to entry                   • more scannable
• allows for single-line rules           • more concise, better for teams
• more flexible for expression           • enforces one declaration per line
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS                     • white-space aware
• very similar to CSS                    • shortcuts for @mixin and @include
• low barrier to entry                   • more scannable
• allows for single-line rules           • more concise, better for teams
• more flexible for expression           • enforces one declaration per line
• compatible with many CSS parsers       • cleaner merges
• easy to integrate with existing CSS
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS                     • white-space aware
• very similar to CSS                    • shortcuts for @mixin and @include
• low barrier to entry                   • more scannable
• allows for single-line rules           • more concise, better for teams
• more flexible for expression           • enforces one declaration per line
• compatible with many CSS parsers       • cleaner merges
• easy to integrate with existing CSS    • DRY, arguably more so.
• DRY
• the “original” syntax
Advantages of each…
SCSS                                    Sass
• the “newer” syntax                     • no curly braces or semicolons
• a super set of CSS                     • white-space aware
• very similar to CSS                    • shortcuts for @mixin and @include
• low barrier to entry                   • more scannable
• allows for single-line rules           • more concise, better for teams
• more flexible for expression           • enforces one declaration per line
• compatible with many CSS parsers       • cleaner merges
• easy to integrate with existing CSS    • DRY, arguably more so.
• DRY
• the “original” syntax
Try both …you may want to use both.
Sass   SCSS
~ sass-convert [input-file] [output-file]


       Sass                SCSS
~ sass-convert [input-file] [output-file]


       Sass                SCSS




                 CSS
Tonight’s Roadmap
• Add Compass to a project
• @import & partials
• @extend
• nesting
• $variables
• @mixin
• sprites
• inline images
• CSS3
Flash Messaging
Let’s refactor the messaging style sheet into Sass.
Flash Messaging
Let’s refactor the messaging style sheet into Sass.
messaging.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Sass Why</title>
  <link href="reset.css" rel="stylesheet" />
  <link href="messaging.css" rel="stylesheet" />
</head>
<body>

  <!-- content here -->

</body>
</html>
Our content…
<div class="flash-info">
  <img src="images/icon-info.png" alt="info icon" class="flash-icon">
  <p>You have mail.</p>
</div>

<div class="flash-success">
  <img src="images/icon-success.png" alt="success icon" class="flash-icon">
  <p>Settings updated!</p>
</div>

<div class="flash-error">
  <img src="images/icon-error.png" alt="error icon" class="flash-icon">
  <p>Please fix the following errors:</p>
  <ul>
    <li>Username requires more pazazz.</li>
    <li>Password is too easy to hack.</li>
    <li>You must be at least this tall to ride this ride.</li>
  </ul>
</div>
Our content…
<div class="flash-info">
  <img src="images/icon-info.png" alt="info icon" class="flash-icon">         info
  <p>You have mail.</p>
</div>

<div class="flash-success">
  <img src="images/icon-success.png" alt="success icon" class="flash-icon">
  <p>Settings updated!</p>
</div>

<div class="flash-error">
  <img src="images/icon-error.png" alt="error icon" class="flash-icon">
  <p>Please fix the following errors:</p>
  <ul>
    <li>Username requires more pazazz.</li>
    <li>Password is too easy to hack.</li>
    <li>You must be at least this tall to ride this ride.</li>
  </ul>
</div>
Our content…
<div class="flash-info">
  <img src="images/icon-info.png" alt="info icon" class="flash-icon">
  <p>You have mail.</p>
</div>

<div class="flash-success">
  <img src="images/icon-success.png" alt="success icon" class="flash-icon">
  <p>Settings updated!</p>                                                    success
</div>

<div class="flash-error">
  <img src="images/icon-error.png" alt="error icon" class="flash-icon">
  <p>Please fix the following errors:</p>
  <ul>
    <li>Username requires more pazazz.</li>
    <li>Password is too easy to hack.</li>
    <li>You must be at least this tall to ride this ride.</li>
  </ul>
</div>
Our content…
<div class="flash-info">
  <img src="images/icon-info.png" alt="info icon" class="flash-icon">
  <p>You have mail.</p>
</div>

<div class="flash-success">
  <img src="images/icon-success.png" alt="success icon" class="flash-icon">
  <p>Settings updated!</p>
</div>

<div class="flash-error">
  <img src="images/icon-error.png" alt="error icon" class="flash-icon">
  <p>Please fix the following errors:</p>
  <ul>
    <li>Username requires more pazazz.</li>
                                                                              error
    <li>Password is too easy to hack.</li>
    <li>You must be at least this tall to ride this ride.</li>
  </ul>
</div>
messaging.css
body {
  background: #e3e3e3;
  margin: 20px;
  font: 16px/24px sans-serif;
}

ul {
  list-style: disc;
  margin-left: 20px;
}
messaging.css
body {
  background: #e3e3e3;
  margin: 20px;                 layout
  font: 16px/24px sans-serif;
}

ul {
  list-style: disc;
  margin-left: 20px;
}
messaging.css
body {
  background: #e3e3e3;
  margin: 20px;
  font: 16px/24px sans-serif;
}

ul {
  list-style: disc;
  margin-left: 20px;            prose
}
messaging.css
.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                                      font-weight: normal;
                                                                    }

                                                                    .flash-icon {
                                                                      display: block;
                                                                      position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
messaging.css
.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                                      font-weight: normal;
                                                                    }
   info
                                                                    .flash-icon {
                                                                      display: block;
                                                                      position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
messaging.css
.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                                      font-weight: normal;

                                  success                           }

                                                                    .flash-icon {
                                                                      display: block;
                                                                      position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
messaging.css                                                    error

.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                                      font-weight: normal;
                                                                    }

                                                                    .flash-icon {
                                                                      display: block;
                                                                      position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
messaging.css
.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                 error items        }
                                                                      font-weight: normal;



                                                                    .flash-icon {
                                                                      display: block;
                                                                      position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
messaging.css
.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                                      font-weight: normal;
                                                                    }

                                                                    .flash-icon {
                                                                      display: block;
                                                      icon            position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
reset.css
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron
ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt
,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo
t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr
oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:
100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height:
1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:
0}caption,th,td{text-align:left;font-weight:normal;vertical-
align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft
er{content:none}a
img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s
ection,summary{display:block}
reset.css
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron
ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt
,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo
t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr
oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:
100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height:
1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:
0}caption,th,td{text-align:left;font-weight:normal;vertical-
align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft
er{content:none}a
img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s
ection,summary{display:block}


                                                                     Eric Meyer’s Reset
reset.css
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron
ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt
,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo
t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr
oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:
100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height:
1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:
0}caption,th,td{text-align:left;font-weight:normal;vertical-
align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft
er{content:none}a
img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s
ection,summary{display:block}


• Browsers have a default style sheet                                Eric Meyer’s Reset
reset.css
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron
ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt
,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo
t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr
oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:
100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height:
1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:
0}caption,th,td{text-align:left;font-weight:normal;vertical-
align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft
er{content:none}a
img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s
ection,summary{display:block}


• Browsers have a default style sheet                                Eric Meyer’s Reset
• Browser style sheets are different
reset.css
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron
ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt
,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo
t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr
oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:
100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height:
1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:
0}caption,th,td{text-align:left;font-weight:normal;vertical-
align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft
er{content:none}a
img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s
ection,summary{display:block}


• Browsers have a default style sheet             Eric Meyer’s Reset
• Browser style sheets are different
• A reset style sheet overrides default browser styles
Add Compass to project
        ~
Add Compass to project
        ~ cd sass-why
        ~/sass-why
Add Compass to project
        ~ cd sass-why
        ~/sass-why compass create
        ~/sass-why
Add Compass to project
Add Compass to project
         Compass configuration file
Add Compass to project
         Compass configuration file
Add Compass to project




         Sass files (SCSS syntax)
Add Compass to project




        CSS compiled from Sass files
Add Compass to project
Add Compass to project
Add Compass to project
Add Compass to project
Add Compass to project
Add Compass to project
        ~ cd sass-why
        ~/sass-why compass create
        ~/sass-why
Add Compass to project
        ~ cd sass-why
        ~/sass-why compass create
        ~/sass-why compass compile
           create stylesheets/messaging.css
           create stylesheets/reset.css
        ~/sass-why
messaging.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Sass Why</title>
  <link href="reset.css" rel="stylesheet" />
  <link href="messaging.css" rel="stylesheet" />
</head>
<body>

  <div class="flash-info"> •••

  <div class="flash-success"> •••

  <div class="flash-error"> •••

</body>
</html>
messaging.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Sass Why</title>
  <link href="reset.css" rel="stylesheet" />
  <link href="messaging.css" rel="stylesheet" />
</head>
<body>

  <div class="flash-info"> •••

  <div class="flash-success"> •••
                                                   update links
  <div class="flash-error"> •••

</body>
</html>
messaging.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Sass Why</title>
  <link href="stylesheets/reset.css" rel="stylesheet" />
  <link href="stylesheets/messaging.css" rel="stylesheet" />
</head>
<body>

  <div class="flash-info"> •••

  <div class="flash-success"> •••
                                                     update links
  <div class="flash-error"> •••

</body>
</html>
Let’s abstract a little more.
@import (in Sass)
@import (in Sass)
• not during page render in browser like in CSS
@import (in Sass)
• not during page render in browser like in CSS
• when compiling Sass to CSS
@import (in Sass)
• not during page render in browser like in CSS
• when compiling Sass to CSS
• organize your styles into logical partials
@import (in Sass)
• not during page render in browser like in CSS
• when compiling Sass to CSS
• organize your styles into logical partials
• combine many files into one
@import (in Sass)
• not during page render in browser like in CSS
• when compiling Sass to CSS
• organize your styles into logical partials
• combine many files into one
• serve fewer css files per request
messaging.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Sass Why</title>
  <link href="stylesheets/reset.css" rel="stylesheet" />
  <link href="stylesheets/messaging.css" rel="stylesheet" />
</head>
<body>

  <div class="flash-info"> •••

  <div class="flash-success"> •••

  <div class="flash-error"> •••

</body>
</html>
messaging.html
<!DOCTYPE html>
<html>                                    remove these
<head>
  <meta charset="utf-8">
  <title>Sass Why</title>
  <link href="stylesheets/reset.css" rel="stylesheet" />
  <link href="stylesheets/messaging.css" rel="stylesheet" />
</head>
<body>

  <div class="flash-info"> •••

  <div class="flash-success"> •••

  <div class="flash-error"> •••

</body>
</html>
messaging.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Sass Why</title>
  <link href="stylesheets/screen.css" rel="stylesheet" />
</head>
<body>

  <div class="flash-info"> •••
                                           add screen.css
  <div class="flash-success"> •••

  <div class="flash-error"> •••

</body>
</html>
Remove reset and compiled css
rename to screen.scss
rename to screen.scss
create two partials
create two partials
_layout.scss
body {
  background: #e3e3e3;
  margin: 20px;
                                layout
  font: 16px/24px sans-serif;
}

ul {
  list-style: disc;
  margin-left: 20px;            prose
}
_messaging.scss
.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                                      font-weight: normal;
                                                                    }

                                                                    .flash-icon {
                                                                      display: block;
                                                                      position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
screen.scss
screen.scss
@import "layout";
screen.scss
@import "layout";
@import "messaging";
screen.scss
@import "compass/reset";
@import "layout";
@import "messaging";
screen.scss
@import "compass/reset";
@import "layout";
@import "messaging";




   Let’s compile
screen.scss
@import "compass/reset";
@import "layout";
@import "messaging";




  Compass doesn’t compile partials
@extend
@extend
When one element should have all the styles of another,
plus its own styles.
_messaging.scss
.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                                      font-weight: normal;
                                                                    }

                                                                    .flash-icon {
                                                                      display: block;
                                                                      position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
_messaging.scss
.flash-info {                     .flash-success {                  .flash-error {
  position: relative;               position: relative;               position: relative;
  margin: 0 auto 15px;              margin: 0 auto 15px;              margin: 0 auto 15px;
  width: 435px;                     width: 435px;                     width: 435px;
  background: #a4a4a4;              background: #1b942a;              background: #ef9000;
  border-radius: 5px;               border-radius: 5px;               border-radius: 5px;
  padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;     padding: 10px 50px 10px 15px;
  color: white;                     color: white;                     color: white;
  font-weight: bold;                font-weight: bold;                font-weight: bold;
  text-shadow: 0 -1px #838484;      text-shadow: 0 -1px #1a7e1c;      text-shadow: 0 -1px #e8541c;
}                                 }                                 }
                                                                    .flash-error li {
                                                                      font-weight: normal;
                                                                    }

                                                                    .flash-icon {
                 unique style declarations                            display: block;
                                                                      position: absolute;
                                                                      top: 11px;
                                                                      right: 12px;
                                                                    }
_messaging.scss
.flash-info,                      .flash-info {                    .flash-icon {
.flash-success,                     background: #a4a4a4;             display: block;
.flash-error {                      text-shadow: 0 -1px #838484;     position: absolute;
  position: relative;             }                                  top: 11px;
  margin: 0 auto 15px;                                               right: 12px;
  width: 435px;                   .flash-success {                 }
  border-radius: 5px;               background: #1b942a;
  padding: 10px 50px 10px 15px;     text-shadow: 0 -1px #1a7e1c;
  color: white;                   }
  font-weight: bold;
}                                 .flash-error {
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
_messaging.scss
.flash-info,                      .flash-info {                    .flash-icon {
.flash-success,                     background: #a4a4a4;             display: block;
.flash-error {                      text-shadow: 0 -1px #838484;     position: absolute;
  position: relative;             }                                  top: 11px;
  margin: 0 auto 15px;                                               right: 12px;
  width: 435px;                   .flash-success {                 }
  border-radius: 5px;               background: #1b942a;
  padding: 10px 50px 10px 15px;     text-shadow: 0 -1px #1a7e1c;
  color: white;                   }
  font-weight: bold;
}                                 .flash-error {
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               background: #a4a4a4;             display: block;
  margin: 0 auto 15px;              text-shadow: 0 -1px #838484;     position: absolute;
  width: 435px;                   }                                  top: 11px;
  border-radius: 5px;                                                right: 12px;
  padding: 10px 50px 10px 15px;   .flash-success {                 }
  color: white;                     background: #1b942a;
  font-weight: bold;                text-shadow: 0 -1px #1a7e1c;
}                                 }

                                  .flash-error {
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               background: #a4a4a4;             display: block;
  margin: 0 auto 15px;              text-shadow: 0 -1px #838484;     position: absolute;
  width: 435px;                   }                                  top: 11px;
  border-radius: 5px;                                                right: 12px;
  padding: 10px 50px 10px 15px;   .flash-success {                 }
  color: white;                     background: #1b942a;
  font-weight: bold;                text-shadow: 0 -1px #1a7e1c;
}                                 }

                                  .flash-error {
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               @extend .flash-message;          display: block;
  margin: 0 auto 15px;              background: #a4a4a4;             position: absolute;
  width: 435px;                     text-shadow: 0 -1px #838484;     top: 11px;
  border-radius: 5px;             }                                  right: 12px;
  padding: 10px 50px 10px 15px;                                    }
  color: white;                   .flash-success {
  font-weight: bold;                @extend .flash-message;
}                                   background: #1b942a;
                                    text-shadow: 0 -1px #1a7e1c;
                                  }

                                  .flash-error {
                                    @extend .flash-message;
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               @extend .flash-message;          display: block;
  margin: 0 auto 15px;              background: #a4a4a4;             position: absolute;
  width: 435px;                     text-shadow: 0 -1px #838484;     top: 11px;
  border-radius: 5px;             }                                  right: 12px;
  padding: 10px 50px 10px 15px;                                    }
  color: white;                   .flash-success {
  font-weight: bold;                @extend .flash-message;
}                                   background: #1b942a;
                                    text-shadow: 0 -1px #1a7e1c;
                                  }

                                  .flash-error {
                                    @extend .flash-message;
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
Generated CSS
.flash-message,                   .flash-info {                    .flash-icon {
.flash-info,                        background: #a4a4a4;             display: block;
.flash-success,                     text-shadow: 0 -1px #838484;     position: absolute;
.flash-error {                    }                                  top: 11px;
  position: relative;                                                right: 12px;
  margin: 0 auto 15px;            .flash-success {                 }
  width: 435px;                     background: #1b942a;
  border-radius: 5px;               text-shadow: 0 -1px #1a7e1c;
  padding: 10px 50px 10px 15px;   }
  color: white;
  font-weight: bold;              .flash-error {
}                                   background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
Nesting
Nesting
• group styles together
Nesting
• group styles together
• avoid duplication of selectors
Nesting
• group styles together
• avoid duplication of selectors
• keep your code DRY
Nesting
• group styles together
• avoid duplication of selectors
• keep your code DRY

Sass nesting ≠ html structure
Nesting                            FASTER
• group styles together
• avoid duplication of selectors   TRAFFIC
• keep your code DRY
                                    KEEP
Sass nesting ≠ html structure
                                    LEFT
Warning about Nesting
Warning about Nesting
.subset-section
  background-color: #FFF
  width: 960px
  .subset-skus
    width: 790px
    .subset-selection
      float: left
      width: 790px
      .registrant-needs
        margin-bottom: 10px
        text-align: right
        .subset-attributes
          width: 430px
          float: left
          .subset-pricing
            display: block
            text-align: right
            .price-special
               font-size: 11px
               .currency
                 font-size: 16px
Warning about Nesting
Warning about Nesting
.subset-section {
  background-color: white;
  width: 960px; }
  .subset-section .subset-skus {
    width: 790px; }
    .subset-section .subset-skus .subset-selection {
      float: left;
      width: 790px; }
      .subset-section .subset-skus .subset-selection .registrant-needs {
        margin-bottom: 10px;
        text-align: right; }
        .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes {
          width: 430px;
          float: left; }
          .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-pricing
            display: block;
            text-align: right; }
            .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-prici
              font-size: 11px; }
            .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-prici
              font-size: 16px; }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               @extend .flash-message;          display: block;
  margin: 0 auto 15px;              background: #a4a4a4;             position: absolute;
  width: 435px;                     text-shadow: 0 -1px #838484;     top: 11px;
  border-radius: 5px;             }                                  right: 12px;
  padding: 10px 50px 10px 15px;                                    }
  color: white;                   .flash-success {
  font-weight: bold;                @extend .flash-message;
}                                   background: #1b942a;
                                    text-shadow: 0 -1px #1a7e1c;
                                  }

                                  .flash-error {
                                    @extend .flash-message;
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               @extend .flash-message;          display: block;
  margin: 0 auto 15px;              background: #a4a4a4;             position: absolute;
  width: 435px;                     text-shadow: 0 -1px #838484;     top: 11px;
  border-radius: 5px;             }                                  right: 12px;
  padding: 10px 50px 10px 15px;                                    }
  color: white;                   .flash-success {
  font-weight: bold;                @extend .flash-message;
}                                   background: #1b942a;
                                    text-shadow: 0 -1px #1a7e1c;
                                  }

                                  .flash-error {
                                    @extend .flash-message;
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                  }
                                  .flash-error li {
                                    font-weight: normal;
                                  }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               @extend .flash-message;          display: block;
  margin: 0 auto 15px;              background: #a4a4a4;             position: absolute;
  width: 435px;                     text-shadow: 0 -1px #838484;     top: 11px;
  border-radius: 5px;             }                                  right: 12px;
  padding: 10px 50px 10px 15px;                                    }
  color: white;                   .flash-success {
  font-weight: bold;                @extend .flash-message;
}                                   background: #1b942a;
                                    text-shadow: 0 -1px #1a7e1c;
                                  }

                                  .flash-error {
                                    @extend .flash-message;
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                    .flash-error li {
                                      font-weight: normal;
                                    }
                                  }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               @extend .flash-message;          display: block;
  margin: 0 auto 15px;              background: #a4a4a4;             position: absolute;
  width: 435px;                     text-shadow: 0 -1px #838484;     top: 11px;
  border-radius: 5px;             }                                  right: 12px;
  padding: 10px 50px 10px 15px;                                    }
  color: white;                   .flash-success {
  font-weight: bold;                @extend .flash-message;
}                                   background: #1b942a;
                                    text-shadow: 0 -1px #1a7e1c;
                                  }

                                  .flash-error {
                                    @extend .flash-message;
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                    .flash-error li {
                                      font-weight: normal;
                                    }
                                  }
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               @extend .flash-message;          display: block;
  margin: 0 auto 15px;              background: #a4a4a4;             position: absolute;
  width: 435px;                     text-shadow: 0 -1px #838484;     top: 11px;
  border-radius: 5px;             }                                  right: 12px;
  padding: 10px 50px 10px 15px;                                    }
  color: white;                   .flash-success {
  font-weight: bold;                @extend .flash-message;
}                                   background: #1b942a;
                                    text-shadow: 0 -1px #1a7e1c;
                                  }

                                  .flash-error {
                                    @extend .flash-message;
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                    li {
                                      font-weight: normal;
                                    }
                                  }
.flash-message, .flash-info, .flash-success, .flash-error {
  position: relative;
  margin: 0 auto 15px;
  width: 435px;
  border-radius: 5px;
  padding: 10px 50px 10px 15px;
  color: white;
  font-weight: bold; }

.flash-info {
  background: #a4a4a4;
  text-shadow: 0 -1px #838484; }
                                        .flash-icon {
                                          display: block;
.flash-success {
                                          position: absolute;
  background: #1b942a;
                                          top: 11px;
  text-shadow: 0 -1px #1a7e1c; }
                                          right: 12px; }

.flash-error {
  background: #ef9000;
  text-shadow: 0 -1px #e8541c; }
  .flash-error li {
    font-weight: normal; }




                                                                screen.css
.flash-message, .flash-info, .flash-success, .flash-error {
  position: relative;
  margin: 0 auto 15px;
  width: 435px;
  border-radius: 5px;
  padding: 10px 50px 10px 15px;
  color: white;
  font-weight: bold; }

.flash-info {
  background: #a4a4a4;
  text-shadow: 0 -1px #838484; }
                                        .flash-icon {
                                          display: block;
.flash-success {
                                          position: absolute;
  background: #1b942a;
                                          top: 11px;
  text-shadow: 0 -1px #1a7e1c; }
                                          right: 12px; }

.flash-error {
  background: #ef9000;
  text-shadow: 0 -1px #e8541c; }
  .flash-error li {
    font-weight: normal; }
                                                              output_style = :nested

                                                                screen.css
.flash-message, .flash-info, .flash-success, .flash-error {
  position: relative;
  margin: 0 auto 15px;
  width: 435px;
  border-radius: 5px;
  padding: 10px 50px 10px 15px;
  color: white;
  font-weight: bold; }

.flash-info {
  background: #a4a4a4;
  text-shadow: 0 -1px #838484; }
                                        .flash-icon {
                                          display: block;
.flash-success {
                                          position: absolute;
  background: #1b942a;
                                          top: 11px;
  text-shadow: 0 -1px #1a7e1c; }
                                          right: 12px; }

.flash-error {
  background: #ef9000;
  text-shadow: 0 -1px #e8541c; }
  .flash-error li {
    font-weight: normal; }
                                                              output_style = :nested

                                                                screen.css
.flash-message, .flash-info, .flash-success, .flash-error {
  position: relative;
  margin: 0 auto 15px;
  width: 435px;
  border-radius: 5px;
  padding: 10px 50px 10px 15px;
  color: white;
  font-weight: bold; }
                                            output_style
.flash-info {
  background: #a4a4a4;
  text-shadow: 0 -1px #838484; }
                                        .flash-icon {
                                          display: block;
.flash-success {
                                          position: absolute;
  background: #1b942a;
                                          top: 11px;
  text-shadow: 0 -1px #1a7e1c; }
                                          right: 12px; }

.flash-error {
  background: #ef9000;
  text-shadow: 0 -1px #e8541c; }
  .flash-error li {
    font-weight: normal; }
                                                              output_style = :nested

                                                                screen.css
.flash-message, .flash-info, .flash-success, .flash-error {
  position: relative;
  margin: 0 auto 15px;
  width: 435px;
  border-radius: 5px;
  padding: 10px 50px 10px 15px;
  color: white;
  font-weight: bold;
}

.flash-info {
  background: #a4a4a4;
                                        .flash-icon {
  text-shadow: 0 -1px #838484;
                                          display: block;
}
                                          position: absolute;
                                          top: 11px;
.flash-success {
                                          right: 12px;
  background: #1b942a;
                                        }
  text-shadow: 0 -1px #1a7e1c;
}

.flash-error {
  background: #ef9000;
  text-shadow: 0 -1px #e8541c;
                                                       output_style = :expanded

                                                                screen.css
}
.flash-error li {
  font-weight: normal;
}
.flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto 15px;
width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; }

.flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; }

.flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; }

.flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; }
.flash-error li { font-weight: normal; }

.flash-icon { display: block; position: absolute; top: 11px; right: 12px; }




                                                         output_style = :compact

                                                                screen.css
.flash-message,.flash-info,.flash-success,.flash-error{position:relative;margin:0 auto 15px;width:
435px;border-radius:5px;padding:10px 50px 10px 15px;color:white;font-weight:bold}.flash-
info{background:#a4a4a4;text-shadow:0 -1px #838484}.flash-success{background:#1b942a;text-shadow:0
-1px #1a7e1c}.flash-error{background:#ef9000;text-shadow:0 -1px #e8541c}.flash-error li{font-
weight:normal}.flash-icon{display:block;position:absolute;top:11px;right:12px}




                                                   output_style = :compressed

                                                                screen.css
SCSS to Sass
_messaging.scss
.flash-message {                  .flash-info {                    .flash-icon {
  position: relative;               @extend .flash-message;          display: block;
  margin: 0 auto 15px;              background: #a4a4a4;             position: absolute;
  width: 435px;                     text-shadow: 0 -1px #838484;     top: 11px;
  border-radius: 5px;             }                                  right: 12px;
  padding: 10px 50px 10px 15px;                                    }
  color: white;                   .flash-success {
  font-weight: bold;                @extend .flash-message;
}                                   background: #1b942a;
                                    text-shadow: 0 -1px #1a7e1c;
                                  }

                                  .flash-error {
                                    @extend .flash-message;
                                    background: #ef9000;
                                    text-shadow: 0 -1px #e8541c;
                                    li {
                                      font-weight: normal;
                                    }
                                  }
_messaging.sass
.flash-message                   .flash-info                     .flash-icon
  position: relative               @extend .flash-message          display: block
  margin: 0 auto 15px;             background: #a4a4a4             position: absolute
  width: 435px;                    text-shadow: 0 -1px #838484     top: 11px
  border-radius: 5px                                               right: 12px
  padding: 10px 50px 10px 15px   .flash-success
  color: white                     @extend .flash-message
  font-weight: bold                background: #1b942a
                                   text-shadow: 0 -1px #1a7e1c

                                 .flash-error
                                   @extend .flash-message
                                   background: #ef9000
                                   text-shadow: 0 -1px #e8541c
                                   li
                                      font-weight: normal
_messaging.sass
.flash-message                   .flash-info                     .flash-icon
  position: relative               @extend .flash-message          display: block
  margin: 0 auto 15px;             background: #a4a4a4             position: absolute
  width: 435px;                    text-shadow: 0 -1px #838484     top: 11px
  border-radius: 5px                                               right: 12px
  padding: 10px 50px 10px 15px   .flash-success
  color: white                     @extend .flash-message
  font-weight: bold                background: #1b942a
                                   text-shadow: 0 -1px #1a7e1c

                                 .flash-error
                                   @extend .flash-message
                                   background: #ef9000
                                   text-shadow: 0 -1px #e8541c
                                   li
                                      font-weight: normal
screen.scss
@import "compass/reset";
@import "layout";
@import "messaging";
screen.scss
@import "compass/reset";
@import "layout";
@import "messaging";




                  @import supports both syntaxes, no changes here
screen.sass
@import compass/reset
@import layout
@import messaging
screen.sass
@import compass/reset
@import layout
@import messaging




   semicolons removed, quotes optional
$variables
$variables
• containers for values
$variables
• containers for values
• variable name define the purpose of values
$variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
$variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
   • numbers: 5, 8.2, 99%, 20px
$variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
   • numbers: 5, 8.2, 99%, 20px
   • text strings: foo bar, “baz qux”
$variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
   • numbers: 5, 8.2, 99%, 20px
   • text strings: foo bar, “baz qux”
   • colors: #38e1b2, rgba(0, 128, 255, 0.3)
$variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
   • numbers: 5, 8.2, 99%, 20px
   • text strings: foo bar, “baz qux”
   • colors: #38e1b2, rgba(0, 128, 255, 0.3)
   • booleans: true or false
$variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
   • numbers: 5, 8.2, 99%, 20px
   • text strings: foo bar, “baz qux”
   • colors: #38e1b2, rgba(0, 128, 255, 0.3)
   • booleans: true or false
   • lists: 2px 10px 15px or Arial, Helvetica, Courier
_messaging.sass
.flash-message                   .flash-info                     .flash-icon
  position: relative               @extend .flash-message          display: block
  margin: 0 auto 15px              background: #a4a4a4             position: absolute
  width: 435px                     text-shadow: 0 -1px #838484     top: 11px
  border-radius: 5px                                               right: 12px
  padding: 10px 50px 10px 15px   .flash-success
  color: white                     @extend .flash-message
  font-weight: bold                background: #1b942a
                                   text-shadow: 0 -1px #1a7e1c

                                 .flash-error
                                   @extend .flash-message
                                   background: #ef9000
                                   text-shadow: 0 -1px #e8541c
                                   li
                                      font-weight: normal
_messaging.sass
.flash-message                   .flash-info
  position: relative               @extend .flash-message
  margin: 0 auto 15px              background: #a4a4a4
  width: 435px                     text-shadow: 0 -1px #838484
  border-radius: 5px
  padding: 10px 50px 10px 15px   .flash-success
  color: white                     @extend .flash-message
  font-weight: bold                background: #1b942a
                                   text-shadow: 0 -1px #1a7e1c
.flash-icon
  display: block                 .flash-error
  position: absolute               @extend .flash-message
  top: 11px                        background: #ef9000
  right: 12px                      text-shadow: 0 -1px #e8541c
                                   li
                                      font-weight: normal
_messaging.sass
.flash-message                   .flash-info
  position: relative               @extend .flash-message
  margin: 0 auto 15px              background: #a4a4a4
  width: 435px                     text-shadow: 0 -1px #838484
  border-radius: 5px
  padding: 10px 50px 10px 15px   .flash-success
  color: white                     @extend .flash-message
  font-weight: bold                background: #1b942a
                                   text-shadow: 0 -1px #1a7e1c
.flash-icon
  display: block                 .flash-error
  position: absolute               @extend .flash-message
  top: 11px                        background: #ef9000
  right: 12px                      text-shadow: 0 -1px #e8541c
                                   li
                                      font-weight: normal
_messaging.sass
$flash-info-background: #a4a4a4       .flash-info
$flash-info-text-shadow: #838484        @extend .flash-message
$flash-success-background: #1b942a      background: #a4a4a4
$flash-success-text-shadow: #1a7e1c     text-shadow: 0 -1px #838484
$flash-error-background: #ef9000
$flash-error-text-shadow: #e8541c     .flash-success
                                        @extend .flash-message
.flash-message                          background: #1b942a
  position: relative                    text-shadow: 0 -1px #1a7e1c
  margin: 0 auto 15px
  width: 435px                        .flash-error
  border-radius: 5px                    @extend .flash-message
  padding: 10px 50px 10px 15px          background: #ef9000
  color: white                          text-shadow: 0 -1px #e8541c
  font-weight: bold                     li
                                           font-weight: normal
.flash-icon
  display: block
  position: absolute
  top: 11px
  right: 12px
_messaging.sass
$flash-info-background: #a4a4a4       .flash-info
$flash-info-text-shadow: #838484        @extend .flash-message
$flash-success-background: #1b942a      background: $flash-info-background
$flash-success-text-shadow: #1a7e1c     text-shadow: 0 -1px $flash-info-text-shadow
$flash-error-background: #ef9000
$flash-error-text-shadow: #e8541c     .flash-success
                                        @extend .flash-message
.flash-message                          background: $flash-success-background
  position: relative                    text-shadow: 0 -1px $flash-success-text-shadow
  margin: 0 auto 15px
  width: 435px                        .flash-error
  border-radius: 5px                    @extend .flash-message
  padding: 10px 50px 10px 15px          background: $flash-error-background
  color: white                          text-shadow: 0 -1px $flash-error-text-shadow
  font-weight: bold                     li
                                           font-weight: normal
.flash-icon
  display: block
  position: absolute
  top: 11px
  right: 12px
_messaging.sass
$flash-info-background: #a4a4a4       .flash-info
$flash-info-text-shadow: #838484        @extend .flash-message
$flash-success-background: #1b942a      background: $flash-info-background
$flash-success-text-shadow: #1a7e1c     text-shadow: 0 -1px $flash-info-text-shadow
$flash-error-background: #ef9000
$flash-error-text-shadow: #e8541c     .flash-success
                                        @extend .flash-message
.flash-message                          background: $flash-success-background
  position: relative                    text-shadow: 0 -1px $flash-success-text-shadow
  margin: 0 auto 15px
  width: 435px                        .flash-error
  border-radius: 5px                    @extend .flash-message
  padding: 10px 50px 10px 15px          background: $flash-error-background
  color: white                          text-shadow: 0 -1px $flash-error-text-shadow
  font-weight: bold                     li
                                           font-weight: normal
.flash-icon
  display: block
  position: absolute
  top: 11px
  right: 12px
_messaging.sass
.flash-message                   .flash-info
  position: relative               @extend .flash-message
  margin: 0 auto 15px              background: $flash-info-background
  width: 435px                     text-shadow: 0 -1px $flash-info-text-shadow
  border-radius: 5px
  padding: 10px 50px 10px 15px   .flash-success
  color: white                     @extend .flash-message
  font-weight: bold                background: $flash-success-background
                                   text-shadow: 0 -1px $flash-success-text-shadow
.flash-icon
  display: block                 .flash-error
  position: absolute               @extend .flash-message
  top: 11px                        background: $flash-error-background
  right: 12px                      text-shadow: 0 -1px $flash-error-text-shadow
                                   li
                                      font-weight: normal
_config.sass partial
Set all your site-wide values here.
_config.sass
_config.sass
$flash-info-background: #a4a4a4
$flash-info-text-shadow: #838484
$flash-success-background: #1b942a
$flash-success-text-shadow: #1a7e1c
$flash-error-background: #ef9000
$flash-error-text-shadow: #e8541c
_config.sass
$flash-info-background: #a4a4a4
$flash-info-text-shadow: #838484
$flash-success-background: #1b942a
$flash-success-text-shadow: #1a7e1c
$flash-error-background: #ef9000
$flash-error-text-shadow: #e8541c




        screen.sass
@import compass/reset
@import layout
@import messaging
_config.sass
$flash-info-background: #a4a4a4
$flash-info-text-shadow: #838484
$flash-success-background: #1b942a
$flash-success-text-shadow: #1a7e1c
$flash-error-background: #ef9000
$flash-error-text-shadow: #e8541c




          screen.sass
@import   config
@import   compass/reset
@import   layout
@import   messaging
Math
Math
Just like in algebra class, show your work.
Math
Just like in algebra class, show your work.

• Replace arbitrary numbers with calculations.
Math
Just like in algebra class, show your work.

• Replace arbitrary numbers with calculations.
• Control your grid styles
Math
Just like in algebra class, show your work.

• Replace arbitrary numbers with calculations.
• Control your grid styles
• Document logic in your styles
_messaging.sass
.flash-message
  position: relative
  margin: 0 auto 15px
  width: 435px
  border-radius: 5px
  padding: 10px 50px 10px 15px
  color: white
  font-weight: bold
_messaging.sass
.flash-message
  position: relative
  margin: 0 auto 15px
  width: 435px
  border-radius: 5px
  padding: 10px 50px 10px 15px
  color: white
  font-weight: bold
_messaging.sass
$flash-message-width: 500px

.flash-message
  position: relative
  width: 435px
  border-radius: 5px
  padding: 10px 50px 10px 15px
  color: white
  font-weight: bold
_messaging.sass
$flash-message-width: 500px
$flash-message-h-padding: 15px

.flash-message
  position: relative
  width: 435px
  border-radius: 5px
  padding: 10px 50px 10px 15px
  color: white
  font-weight: bold
_messaging.sass
$flash-message-width: 500px
$flash-message-h-padding: 15px
$flash-message-icon-padding: image-width("icon-info.png") + 15px

.flash-message
  position: relative
  width: 435px
  border-radius: 5px
  padding: 10px 50px 10px 15px
  color: white
  font-weight: bold
_messaging.sass
$flash-message-width: 500px
$flash-message-h-padding: 15px
$flash-message-icon-padding: image-width("icon-info.png") + 15px

.flash-message
  position: relative
  width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding
  border-radius: 5px
  padding: 10px 50px 10px 15px
  color: white
  font-weight: bold
_messaging.sass
$flash-message-width: 500px
$flash-message-h-padding: 15px
$flash-message-icon-padding: image-width("icon-info.png") + 15px

.flash-message
  position: relative
  width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding
  border-radius: 5px
  padding: 10px $flash-message-h-padding + $flash-message-icon-padding 10px $flash-message-h-padding
  color: white
  font-weight: bold
@mixin(argument)
A reusable block of content, usually with arguments.
_messaging.sass
.flash-info
  @extend .flash-message
  background: $flash-info-background
  text-shadow: 0 -1px $flash-info-text-shadow

.flash-success
  @extend .flash-message
  background: $flash-success-background
  text-shadow: 0 -1px $flash-success-text-shadow

.flash-error
  @extend .flash-message
  background: $flash-error-background
  text-shadow: 0 -1px $flash-error-text-shadow
  li
     font-weight: normal
_messaging.sass
.flash-info
  @extend .flash-message
  background: $flash-info-background               see
  text-shadow: 0 -1px $flash-info-text-shadow

.flash-success
  @extend .flash-message
  background: $flash-success-background
  text-shadow: 0 -1px $flash-success-text-shadow

.flash-error
  @extend .flash-message
  background: $flash-error-background
  text-shadow: 0 -1px $flash-error-text-shadow
  li
     font-weight: normal
_messaging.sass
.flash-info
  @extend .flash-message
  background: $flash-info-background               see
  text-shadow: 0 -1px $flash-info-text-shadow

.flash-success
  @extend .flash-message
  background: $flash-success-background            the
  text-shadow: 0 -1px $flash-success-text-shadow

.flash-error
  @extend .flash-message
  background: $flash-error-background
  text-shadow: 0 -1px $flash-error-text-shadow
  li
     font-weight: normal
_messaging.sass
.flash-info
  @extend .flash-message
  background: $flash-info-background                 see
  text-shadow: 0 -1px $flash-info-text-shadow

.flash-success
  @extend .flash-message
  background: $flash-success-background              the
  text-shadow: 0 -1px $flash-success-text-shadow

.flash-error
  @extend .flash-message
  background: $flash-error-background
  text-shadow: 0 -1px $flash-error-text-shadow     pattern?
  li
     font-weight: normal
_messaging.sass
@mixin flash-message($type, $background, $text-shadow)
  .flash-#{$type}
    @extend .flash-message
    background: $background
    text-shadow: 0 -1px $text-shadow
    @if $type == error
      li
         font-weight: normal
_messaging.sass
@mixin flash-message($type, $background, $text-shadow)
  .flash-#{$type}
    @extend .flash-message
    background: $background
    text-shadow: 0 -1px $text-shadow
    @if $type == error
      li
         font-weight: normal

@include flash-message(info,    $flash-info-background,    $flash-info-text-shadow)
@include flash-message(success, $flash-success-background, $flash-success-text-shadow)
@include flash-message(error,   $flash-error-background,   $flash-error-text-shadow)
_messaging.sass
=flash-message($type, $background, $text-shadow)
  .flash-#{$type}
    @extend .flash-message
    background: $background
    text-shadow: 0 -1px $text-shadow
    @if $type == error
      li
         font-weight: normal

+flash-message(info,    $flash-info-background,    $flash-info-text-shadow)
+flash-message(success, $flash-success-background, $flash-success-text-shadow)
+flash-message(error,   $flash-error-background,   $flash-error-text-shadow)
Sprites
Surprisingly simple with Compass
Sprites
Surprisingly simple with Compass


    error.png
Sprites
Surprisingly simple with Compass


    error.png

    info.png
Sprites
Surprisingly simple with Compass


    error.png

    info.png

    success.png
Sprites
Surprisingly simple with Compass


    error.png

    info.png

    success.png
Sprites
Surprisingly simple with Compass


    error.png

    info.png                       icon-s5c33447329.png

    success.png
create folder of images to sprite
place images in folder
simplify filenames
_messaging.sass
.flash-icon
  display: block
  position: absolute
  top: 11px
  right: 12px
_messaging.sass
.icon-sprite
  display: block
  position: absolute
  top: 11px
  right: 12px
_messaging.sass
.icon-sprite
  display: block
  position: absolute
  top: 11px
  right: 12px



@import "icon/*.png"
+all-icon-sprites
_messaging.sass
.icon-sprite
  display: block
  position: absolute
  top: 11px
  right: 12px

$icon-sprite-dimensions: true
@import "icon/*.png"
+all-icon-sprites
_messaging.sass
.icon-sprite
  display: block
  position: absolute
  top: 11px
  right: 12px

$icon-sprite-dimensions: true
@import "icon/*.png"
+all-icon-sprites
_messaging.sass
.icon-sprite
  display: block                Compass config file
  position: absolute
  top: 11px
  right: 12px

$icon-sprite-dimensions: true
@import "icon/*.png"
+all-icon-sprites
_messaging.sass
.icon-sprite
  display: block                     Compass config file
  position: absolute
  top: 11px
  right: 12px

$icon-sprite-dimensions: true
@import "icon/*.png"
+all-icon-sprites

                                config.rb
                                http_path = "/"
                                css_dir = "stylesheets"
                                sass_dir = "sass"
                                images_dir = "images"
                                javascripts_dir = "javascripts"
                                output_style = :nested
                                relative_assets = true
                                line_comments = false
_messaging.sass
.icon-sprite
  display: block                     Compass config file
  position: absolute
  top: 11px
  right: 12px

$icon-sprite-dimensions: true
@import "icon/*.png"
+all-icon-sprites

                                config.rb
                                http_path = "/"
                                css_dir = "stylesheets"
                                sass_dir = "sass"
                                images_dir = "images"
                                javascripts_dir = "javascripts"
                                output_style = :nested
                                relative_assets = true
                                line_comments = false
_messaging.sass
.icon-sprite
  display: block                Compass config file
  position: absolute
  top: 11px
  right: 12px

$icon-sprite-dimensions: true
@import "icon/*.png"
+all-icon-sprites
_messaging.sass
.icon-sprite
  display: block                Compass config file
  position: absolute
  top: 11px
  right: 12px

$icon-sprite-dimensions: true
@import "icon/*.png"              generated sprite
+all-icon-sprites




                                  icon-s5c33447329.png
Compiled sprite CSS
.icon-sprite, .icon-error, .icon-info, .icon-success {
  display: block;
  position: absolute;
  top: 11px;
  right: 12px; }

.icon-sprite, .icon-error, .icon-info, .icon-success {
  background: url('../images/icon-sa3bc8b9105.png') no-repeat; }


.icon-error {                       .icon-info {                      .icon-success {
  background-position: 0 0;           background-position: 0 -19px;     background-position: 0 -40px;
  height: 19px;                       height: 21px;                     height: 21px;
  width: 20px; }                      width: 20px; }                    width: 20px; }
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy
Sass Why for the CSS Guy

Más contenido relacionado

Destacado

How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)
How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)
How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)Board of Innovation
 
The Seven Deadly Social Media Sins
The Seven Deadly Social Media SinsThe Seven Deadly Social Media Sins
The Seven Deadly Social Media SinsXPLAIN
 
Five Killer Ways to Design The Same Slide
Five Killer Ways to Design The Same SlideFive Killer Ways to Design The Same Slide
Five Killer Ways to Design The Same SlideCrispy Presentations
 
How People Really Hold and Touch (their Phones)
How People Really Hold and Touch (their Phones)How People Really Hold and Touch (their Phones)
How People Really Hold and Touch (their Phones)Steven Hoober
 
Upworthy: 10 Ways To Win The Internets
Upworthy: 10 Ways To Win The InternetsUpworthy: 10 Ways To Win The Internets
Upworthy: 10 Ways To Win The InternetsUpworthy
 
What 33 Successful Entrepreneurs Learned From Failure
What 33 Successful Entrepreneurs Learned From FailureWhat 33 Successful Entrepreneurs Learned From Failure
What 33 Successful Entrepreneurs Learned From FailureReferralCandy
 
Why Content Marketing Fails
Why Content Marketing FailsWhy Content Marketing Fails
Why Content Marketing FailsRand Fishkin
 
The History of SEO
The History of SEOThe History of SEO
The History of SEOHubSpot
 
How To (Really) Get Into Marketing
How To (Really) Get Into MarketingHow To (Really) Get Into Marketing
How To (Really) Get Into MarketingEd Fry
 
The What If Technique presented by Motivate Design
The What If Technique presented by Motivate DesignThe What If Technique presented by Motivate Design
The What If Technique presented by Motivate DesignMotivate Design
 
10 Powerful Body Language Tips for your next Presentation
10 Powerful Body Language Tips for your next Presentation10 Powerful Body Language Tips for your next Presentation
10 Powerful Body Language Tips for your next PresentationSOAP Presentations
 
Crap. The Content Marketing Deluge.
Crap. The Content Marketing Deluge.Crap. The Content Marketing Deluge.
Crap. The Content Marketing Deluge.Velocity Partners
 
What Would Steve Do? 10 Lessons from the World's Most Captivating Presenters
What Would Steve Do? 10 Lessons from the World's Most Captivating PresentersWhat Would Steve Do? 10 Lessons from the World's Most Captivating Presenters
What Would Steve Do? 10 Lessons from the World's Most Captivating PresentersHubSpot
 
Digital Strategy 101
Digital Strategy 101Digital Strategy 101
Digital Strategy 101Bud Caddell
 
The Search for Meaning in B2B Marketing
The Search for Meaning in B2B MarketingThe Search for Meaning in B2B Marketing
The Search for Meaning in B2B MarketingVelocity Partners
 

Destacado (18)

How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)
How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)
How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)
 
The Seven Deadly Social Media Sins
The Seven Deadly Social Media SinsThe Seven Deadly Social Media Sins
The Seven Deadly Social Media Sins
 
Five Killer Ways to Design The Same Slide
Five Killer Ways to Design The Same SlideFive Killer Ways to Design The Same Slide
Five Killer Ways to Design The Same Slide
 
How People Really Hold and Touch (their Phones)
How People Really Hold and Touch (their Phones)How People Really Hold and Touch (their Phones)
How People Really Hold and Touch (their Phones)
 
Upworthy: 10 Ways To Win The Internets
Upworthy: 10 Ways To Win The InternetsUpworthy: 10 Ways To Win The Internets
Upworthy: 10 Ways To Win The Internets
 
What 33 Successful Entrepreneurs Learned From Failure
What 33 Successful Entrepreneurs Learned From FailureWhat 33 Successful Entrepreneurs Learned From Failure
What 33 Successful Entrepreneurs Learned From Failure
 
Design Your Career 2018
Design Your Career 2018Design Your Career 2018
Design Your Career 2018
 
Why Content Marketing Fails
Why Content Marketing FailsWhy Content Marketing Fails
Why Content Marketing Fails
 
The History of SEO
The History of SEOThe History of SEO
The History of SEO
 
How To (Really) Get Into Marketing
How To (Really) Get Into MarketingHow To (Really) Get Into Marketing
How To (Really) Get Into Marketing
 
The What If Technique presented by Motivate Design
The What If Technique presented by Motivate DesignThe What If Technique presented by Motivate Design
The What If Technique presented by Motivate Design
 
Displaying Data
Displaying DataDisplaying Data
Displaying Data
 
10 Powerful Body Language Tips for your next Presentation
10 Powerful Body Language Tips for your next Presentation10 Powerful Body Language Tips for your next Presentation
10 Powerful Body Language Tips for your next Presentation
 
Crap. The Content Marketing Deluge.
Crap. The Content Marketing Deluge.Crap. The Content Marketing Deluge.
Crap. The Content Marketing Deluge.
 
What Would Steve Do? 10 Lessons from the World's Most Captivating Presenters
What Would Steve Do? 10 Lessons from the World's Most Captivating PresentersWhat Would Steve Do? 10 Lessons from the World's Most Captivating Presenters
What Would Steve Do? 10 Lessons from the World's Most Captivating Presenters
 
Digital Strategy 101
Digital Strategy 101Digital Strategy 101
Digital Strategy 101
 
How Google Works
How Google WorksHow Google Works
How Google Works
 
The Search for Meaning in B2B Marketing
The Search for Meaning in B2B MarketingThe Search for Meaning in B2B Marketing
The Search for Meaning in B2B Marketing
 

Similar a Sass Why for the CSS Guy

HTML&CSS 5 - Intermediate CSS (2/2)
HTML&CSS 5 - Intermediate CSS (2/2)HTML&CSS 5 - Intermediate CSS (2/2)
HTML&CSS 5 - Intermediate CSS (2/2)Dinis Correia
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSSSayanee Basu
 
CSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustCSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustKyle Adams
 
Save time by using SASS/SCSS
Save time by using SASS/SCSSSave time by using SASS/SCSS
Save time by using SASS/SCSSBerit Hlubek
 
Oocss & progressive css3 selectors
Oocss & progressive css3 selectorsOocss & progressive css3 selectors
Oocss & progressive css3 selectorsdaniel_sternlicht
 
Peggy sass vs scss
Peggy  sass vs scssPeggy  sass vs scss
Peggy sass vs scssLearningTech
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Startededgincvg
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書拓樹 谷
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with SassRob Friesel
 
Bloggdesign #2 - hawaa.blogg.no
Bloggdesign #2 - hawaa.blogg.noBloggdesign #2 - hawaa.blogg.no
Bloggdesign #2 - hawaa.blogg.noHannee92
 
Harendra Singh,BCA Third Year
Harendra Singh,BCA Third YearHarendra Singh,BCA Third Year
Harendra Singh,BCA Third Yeardezyneecole
 
Simplify your CSS with Stylus and Nib
Simplify your CSS with Stylus and NibSimplify your CSS with Stylus and Nib
Simplify your CSS with Stylus and NibChristian Joudrey
 

Similar a Sass Why for the CSS Guy (20)

HTML&CSS 5 - Intermediate CSS (2/2)
HTML&CSS 5 - Intermediate CSS (2/2)HTML&CSS 5 - Intermediate CSS (2/2)
HTML&CSS 5 - Intermediate CSS (2/2)
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
 
CSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustCSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie Dust
 
Save time by using SASS/SCSS
Save time by using SASS/SCSSSave time by using SASS/SCSS
Save time by using SASS/SCSS
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 
Sass
SassSass
Sass
 
Sass, Compass
Sass, CompassSass, Compass
Sass, Compass
 
Oocss & progressive css3 selectors
Oocss & progressive css3 selectorsOocss & progressive css3 selectors
Oocss & progressive css3 selectors
 
Peggy sass vs scss
Peggy  sass vs scssPeggy  sass vs scss
Peggy sass vs scss
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
 
Formato encuesta
Formato encuestaFormato encuesta
Formato encuesta
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
Bloggdesign #2 - hawaa.blogg.no
Bloggdesign #2 - hawaa.blogg.noBloggdesign #2 - hawaa.blogg.no
Bloggdesign #2 - hawaa.blogg.no
 
Harendra Singh,BCA Third Year
Harendra Singh,BCA Third YearHarendra Singh,BCA Third Year
Harendra Singh,BCA Third Year
 
Css 2
Css 2Css 2
Css 2
 
Css
CssCss
Css
 
Css 3
Css 3Css 3
Css 3
 
Simplify your CSS with Stylus and Nib
Simplify your CSS with Stylus and NibSimplify your CSS with Stylus and Nib
Simplify your CSS with Stylus and Nib
 

Último

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Último (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Sass Why for the CSS Guy

  • 1. Sass Why for intro to Sass for CSSGuy An the CSS fans
  • 3. CSS IS AWESOME via stevenf.com
  • 4.
  • 5.
  • 10.
  • 11.
  • 12. Sass
  • 14. Sass • CSS meta-language • Simpler, more elegant syntax for CSS
  • 15. Sass • CSS meta-language • Simpler, more elegant syntax for CSS • Helps to create manageable stylesheets
  • 16. Sass • CSS meta-language • Simpler, more elegant syntax for CSS • Helps to create manageable stylesheets • An upgrade to CSS
  • 17. Sass • CSS meta-language • Simpler, more elegant syntax for CSS • Helps to create manageable stylesheets • An upgrade to CSS Sass makes CSS fun again.
  • 18. Two delicious flavors Sass Sass & SCSS • CSS meta-language • Simpler, more elegant syntax for CSS • Helps to create manageable stylesheets • An upgrade to CSS Sass makes CSS fun again.
  • 19.
  • 20. • CSS authoring framework built in Sass
  • 21. • CSS authoring framework built in Sass • Collection of Sass mixins and functions
  • 22. • CSS authoring framework built in Sass • Collection of Sass mixins and functions • Library of the web’s most reusable CSS patterns
  • 23. • CSS authoring framework built in Sass • Collection of Sass mixins and functions • Library of the web’s most reusable CSS patterns • Makes CSS3 easy
  • 24.
  • 28. Two delicous flavors… Sass and SCSS • both functionally equivalent
  • 29. Two delicous flavors… Sass and SCSS • both functionally equivalent • both support the same feature set
  • 30. Two delicous flavors… Sass and SCSS • both functionally equivalent • both support the same feature set • neither will be deprecated
  • 31. Two delicous flavors… Sass and SCSS • both functionally equivalent • both support the same feature set • neither will be deprecated • SCSS is not a successor to Sass
  • 32. Two delicous flavors… Sass and SCSS • both functionally equivalent • both support the same feature set • neither will be deprecated • SCSS is not a successor to Sass • each make different people happy
  • 33. Two delicous flavors… Sass and SCSS • both functionally equivalent • both support the same feature set • neither will be deprecated • SCSS is not a successor to Sass • each make different people happy • some people like both
  • 34.
  • 35. CSS nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; display: block; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  • 36. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } }
  • 37. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; nesting float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } }
  • 38. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; nesting float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } }
  • 39. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; nesting float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } }
  • 40. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; nesting float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } } the parent selector
  • 41. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; nesting float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } } the parent selector
  • 42. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } }
  • 43. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } } SCSS doesn’t care about whitespace nav { width: 500px; margin: 10px auto; background: #ccc; a { float: left; display: block; padding: 0 5px; color: #666; &:hover { color: #000; }}}
  • 44. CSS SCSS nav { nav { background: #ccc; background: #ccc; width: 500px; width: 500px; margin: 10px auto; margin: 10px auto; } a { nav a { float: left; float: left; display: block; display: block; padding: 0 5px; padding: 0 5px; color: #666; color: #666; &:hover { } color: #000; nav a:hover { } color: #000; } } }
  • 45. CSS SCSS Sass nav { nav { nav background: #ccc; background: #ccc; background: #ccc width: 500px; width: 500px; width: 500px margin: 10px auto; margin: 10px auto; margin: 10px auto } a { a nav a { float: left; float: left float: left; display: block; display: block display: block; padding: 0 5px; padding: 0 5px padding: 0 5px; color: #666; color: #666 color: #666; &:hover { &:hover } color: #000; color: #000 nav a:hover { } color: #000; } } }
  • 46. CSS SCSS Sass nav { nav { nav background: #ccc; background: #ccc; background: #ccc width: 500px; width: 500px; width: 500px margin: 10px auto; margin: 10px auto; margin: 10px auto } a { a nav a { float: left; float: left float: left; display: block; display: block display: block; padding: 0 5px; padding: 0 5px padding: 0 5px; color: #666; color: #666 color: #666; &:hover { &:hover } color: #000; color: #000 nav a:hover { } color: #000; } } }
  • 47. CSS SCSS Sass nav { nav { nav background: #ccc; background: #ccc; background: #ccc width: 500px; width: 500px; width: 500px margin: 10px auto; margin: 10px auto; margin: 10px auto } a { a nav a { float: left; float: left float: left; display: block; display: block display: block; padding: 0 5px; padding: 0 5px padding: 0 5px; color: #666; color: #666 color: #666; &:hover { &:hover } color: #000; color: #000 nav a:hover { } color: #000; } } }
  • 48. CSS SCSS Sass nav { nav { nav background: #ccc; background: #ccc; background: #ccc width: 500px; width: 500px; width: 500px margin: 10px auto; margin: 10px auto; margin: 10px auto } a { a nav a { float: left; float: left float: left; display: block; display: block display: block; padding: 0 5px; padding: 0 5px padding: 0 5px; color: #666; color: #666 color: #666; &:hover { &:hover } color: #000; color: #000 nav a:hover { } color: #000; } } }
  • 49.
  • 51. Advantages of each… SCSS Sass • the “newer” syntax
  • 52. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS
  • 53. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS • very similar to CSS
  • 54. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS • very similar to CSS • low barrier to entry
  • 55. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS • very similar to CSS • low barrier to entry • allows for single-line rules
  • 56. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS • very similar to CSS • low barrier to entry • allows for single-line rules • more flexible for expression
  • 57. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS • very similar to CSS • low barrier to entry • allows for single-line rules • more flexible for expression • compatible with many CSS parsers
  • 58. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS • very similar to CSS • low barrier to entry • allows for single-line rules • more flexible for expression • compatible with many CSS parsers • easy to integrate with existing CSS
  • 59. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS • very similar to CSS • low barrier to entry • allows for single-line rules • more flexible for expression • compatible with many CSS parsers • easy to integrate with existing CSS • DRY
  • 60. Advantages of each… SCSS Sass • the “newer” syntax • a super set of CSS • very similar to CSS • low barrier to entry • allows for single-line rules • more flexible for expression • compatible with many CSS parsers • easy to integrate with existing CSS • DRY • the “original” syntax
  • 61. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • very similar to CSS • low barrier to entry • allows for single-line rules • more flexible for expression • compatible with many CSS parsers • easy to integrate with existing CSS • DRY • the “original” syntax
  • 62. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • white-space aware • very similar to CSS • low barrier to entry • allows for single-line rules • more flexible for expression • compatible with many CSS parsers • easy to integrate with existing CSS • DRY • the “original” syntax
  • 63. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • white-space aware • very similar to CSS • shortcuts for @mixin and @include • low barrier to entry • allows for single-line rules • more flexible for expression • compatible with many CSS parsers • easy to integrate with existing CSS • DRY • the “original” syntax
  • 64. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • white-space aware • very similar to CSS • shortcuts for @mixin and @include • low barrier to entry • more scannable • allows for single-line rules • more flexible for expression • compatible with many CSS parsers • easy to integrate with existing CSS • DRY • the “original” syntax
  • 65. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • white-space aware • very similar to CSS • shortcuts for @mixin and @include • low barrier to entry • more scannable • allows for single-line rules • more concise, better for teams • more flexible for expression • compatible with many CSS parsers • easy to integrate with existing CSS • DRY • the “original” syntax
  • 66. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • white-space aware • very similar to CSS • shortcuts for @mixin and @include • low barrier to entry • more scannable • allows for single-line rules • more concise, better for teams • more flexible for expression • enforces one declaration per line • compatible with many CSS parsers • easy to integrate with existing CSS • DRY • the “original” syntax
  • 67. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • white-space aware • very similar to CSS • shortcuts for @mixin and @include • low barrier to entry • more scannable • allows for single-line rules • more concise, better for teams • more flexible for expression • enforces one declaration per line • compatible with many CSS parsers • cleaner merges • easy to integrate with existing CSS • DRY • the “original” syntax
  • 68. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • white-space aware • very similar to CSS • shortcuts for @mixin and @include • low barrier to entry • more scannable • allows for single-line rules • more concise, better for teams • more flexible for expression • enforces one declaration per line • compatible with many CSS parsers • cleaner merges • easy to integrate with existing CSS • DRY, arguably more so. • DRY • the “original” syntax
  • 69. Advantages of each… SCSS Sass • the “newer” syntax • no curly braces or semicolons • a super set of CSS • white-space aware • very similar to CSS • shortcuts for @mixin and @include • low barrier to entry • more scannable • allows for single-line rules • more concise, better for teams • more flexible for expression • enforces one declaration per line • compatible with many CSS parsers • cleaner merges • easy to integrate with existing CSS • DRY, arguably more so. • DRY • the “original” syntax Try both …you may want to use both.
  • 70. Sass SCSS
  • 71. ~ sass-convert [input-file] [output-file] Sass SCSS
  • 72. ~ sass-convert [input-file] [output-file] Sass SCSS CSS
  • 73. Tonight’s Roadmap • Add Compass to a project • @import & partials • @extend • nesting • $variables • @mixin • sprites • inline images • CSS3
  • 74. Flash Messaging Let’s refactor the messaging style sheet into Sass.
  • 75. Flash Messaging Let’s refactor the messaging style sheet into Sass.
  • 76. messaging.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="reset.css" rel="stylesheet" /> <link href="messaging.css" rel="stylesheet" /> </head> <body> <!-- content here --> </body> </html>
  • 77. Our content… <div class="flash-info"> <img src="images/icon-info.png" alt="info icon" class="flash-icon"> <p>You have mail.</p> </div> <div class="flash-success"> <img src="images/icon-success.png" alt="success icon" class="flash-icon"> <p>Settings updated!</p> </div> <div class="flash-error"> <img src="images/icon-error.png" alt="error icon" class="flash-icon"> <p>Please fix the following errors:</p> <ul> <li>Username requires more pazazz.</li> <li>Password is too easy to hack.</li> <li>You must be at least this tall to ride this ride.</li> </ul> </div>
  • 78. Our content… <div class="flash-info"> <img src="images/icon-info.png" alt="info icon" class="flash-icon"> info <p>You have mail.</p> </div> <div class="flash-success"> <img src="images/icon-success.png" alt="success icon" class="flash-icon"> <p>Settings updated!</p> </div> <div class="flash-error"> <img src="images/icon-error.png" alt="error icon" class="flash-icon"> <p>Please fix the following errors:</p> <ul> <li>Username requires more pazazz.</li> <li>Password is too easy to hack.</li> <li>You must be at least this tall to ride this ride.</li> </ul> </div>
  • 79. Our content… <div class="flash-info"> <img src="images/icon-info.png" alt="info icon" class="flash-icon"> <p>You have mail.</p> </div> <div class="flash-success"> <img src="images/icon-success.png" alt="success icon" class="flash-icon"> <p>Settings updated!</p> success </div> <div class="flash-error"> <img src="images/icon-error.png" alt="error icon" class="flash-icon"> <p>Please fix the following errors:</p> <ul> <li>Username requires more pazazz.</li> <li>Password is too easy to hack.</li> <li>You must be at least this tall to ride this ride.</li> </ul> </div>
  • 80. Our content… <div class="flash-info"> <img src="images/icon-info.png" alt="info icon" class="flash-icon"> <p>You have mail.</p> </div> <div class="flash-success"> <img src="images/icon-success.png" alt="success icon" class="flash-icon"> <p>Settings updated!</p> </div> <div class="flash-error"> <img src="images/icon-error.png" alt="error icon" class="flash-icon"> <p>Please fix the following errors:</p> <ul> <li>Username requires more pazazz.</li> error <li>Password is too easy to hack.</li> <li>You must be at least this tall to ride this ride.</li> </ul> </div>
  • 81. messaging.css body { background: #e3e3e3; margin: 20px; font: 16px/24px sans-serif; } ul { list-style: disc; margin-left: 20px; }
  • 82. messaging.css body { background: #e3e3e3; margin: 20px; layout font: 16px/24px sans-serif; } ul { list-style: disc; margin-left: 20px; }
  • 83. messaging.css body { background: #e3e3e3; margin: 20px; font: 16px/24px sans-serif; } ul { list-style: disc; margin-left: 20px; prose }
  • 84. messaging.css .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  • 85. messaging.css .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { font-weight: normal; } info .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  • 86. messaging.css .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { font-weight: normal; success } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  • 87. messaging.css error .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  • 88. messaging.css .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { error items } font-weight: normal; .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  • 89. messaging.css .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { font-weight: normal; } .flash-icon { display: block; icon position: absolute; top: 11px; right: 12px; }
  • 90. reset.css html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt ,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size: 100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height: 1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing: 0}caption,th,td{text-align:left;font-weight:normal;vertical- align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft er{content:none}a img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s ection,summary{display:block}
  • 91. reset.css html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt ,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size: 100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height: 1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing: 0}caption,th,td{text-align:left;font-weight:normal;vertical- align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft er{content:none}a img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s ection,summary{display:block} Eric Meyer’s Reset
  • 92. reset.css html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt ,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size: 100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height: 1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing: 0}caption,th,td{text-align:left;font-weight:normal;vertical- align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft er{content:none}a img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s ection,summary{display:block} • Browsers have a default style sheet Eric Meyer’s Reset
  • 93. reset.css html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt ,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size: 100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height: 1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing: 0}caption,th,td{text-align:left;font-weight:normal;vertical- align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft er{content:none}a img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s ection,summary{display:block} • Browsers have a default style sheet Eric Meyer’s Reset • Browser style sheets are different
  • 94. reset.css html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acron ym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt ,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoo t,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgr oup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size: 100%;font:inherit;vertical-align:baseline;margin:0;padding:0}body{line-height: 1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing: 0}caption,th,td{text-align:left;font-weight:normal;vertical- align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:aft er{content:none}a img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,s ection,summary{display:block} • Browsers have a default style sheet Eric Meyer’s Reset • Browser style sheets are different • A reset style sheet overrides default browser styles
  • 95. Add Compass to project ~
  • 96. Add Compass to project ~ cd sass-why ~/sass-why
  • 97. Add Compass to project ~ cd sass-why ~/sass-why compass create ~/sass-why
  • 98. Add Compass to project
  • 99. Add Compass to project Compass configuration file
  • 100. Add Compass to project Compass configuration file
  • 101. Add Compass to project Sass files (SCSS syntax)
  • 102. Add Compass to project CSS compiled from Sass files
  • 103. Add Compass to project
  • 104. Add Compass to project
  • 105. Add Compass to project
  • 106. Add Compass to project
  • 107. Add Compass to project
  • 108. Add Compass to project ~ cd sass-why ~/sass-why compass create ~/sass-why
  • 109. Add Compass to project ~ cd sass-why ~/sass-why compass create ~/sass-why compass compile create stylesheets/messaging.css create stylesheets/reset.css ~/sass-why
  • 110. messaging.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="reset.css" rel="stylesheet" /> <link href="messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html>
  • 111. messaging.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="reset.css" rel="stylesheet" /> <link href="messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• update links <div class="flash-error"> ••• </body> </html>
  • 112. messaging.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="stylesheets/reset.css" rel="stylesheet" /> <link href="stylesheets/messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• update links <div class="flash-error"> ••• </body> </html>
  • 113.
  • 114. Let’s abstract a little more.
  • 116. @import (in Sass) • not during page render in browser like in CSS
  • 117. @import (in Sass) • not during page render in browser like in CSS • when compiling Sass to CSS
  • 118. @import (in Sass) • not during page render in browser like in CSS • when compiling Sass to CSS • organize your styles into logical partials
  • 119. @import (in Sass) • not during page render in browser like in CSS • when compiling Sass to CSS • organize your styles into logical partials • combine many files into one
  • 120. @import (in Sass) • not during page render in browser like in CSS • when compiling Sass to CSS • organize your styles into logical partials • combine many files into one • serve fewer css files per request
  • 121. messaging.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="stylesheets/reset.css" rel="stylesheet" /> <link href="stylesheets/messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html>
  • 122. messaging.html <!DOCTYPE html> <html> remove these <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="stylesheets/reset.css" rel="stylesheet" /> <link href="stylesheets/messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html>
  • 123. messaging.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="stylesheets/screen.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• add screen.css <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html>
  • 124. Remove reset and compiled css
  • 125.
  • 130. _layout.scss body { background: #e3e3e3; margin: 20px; layout font: 16px/24px sans-serif; } ul { list-style: disc; margin-left: 20px; prose }
  • 131. _messaging.scss .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  • 137. screen.scss @import "compass/reset"; @import "layout"; @import "messaging"; Compass doesn’t compile partials
  • 139. @extend When one element should have all the styles of another, plus its own styles.
  • 140. _messaging.scss .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  • 141. _messaging.scss .flash-info { .flash-success { .flash-error { position: relative; position: relative; position: relative; margin: 0 auto 15px; margin: 0 auto 15px; margin: 0 auto 15px; width: 435px; width: 435px; width: 435px; background: #a4a4a4; background: #1b942a; background: #ef9000; border-radius: 5px; border-radius: 5px; border-radius: 5px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; padding: 10px 50px 10px 15px; color: white; color: white; color: white; font-weight: bold; font-weight: bold; font-weight: bold; text-shadow: 0 -1px #838484; text-shadow: 0 -1px #1a7e1c; text-shadow: 0 -1px #e8541c; } } } .flash-error li { font-weight: normal; } .flash-icon { unique style declarations display: block; position: absolute; top: 11px; right: 12px; }
  • 142. _messaging.scss .flash-info, .flash-info { .flash-icon { .flash-success, background: #a4a4a4; display: block; .flash-error { text-shadow: 0 -1px #838484; position: absolute; position: relative; } top: 11px; margin: 0 auto 15px; right: 12px; width: 435px; .flash-success { } border-radius: 5px; background: #1b942a; padding: 10px 50px 10px 15px; text-shadow: 0 -1px #1a7e1c; color: white; } font-weight: bold; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 143. _messaging.scss .flash-info, .flash-info { .flash-icon { .flash-success, background: #a4a4a4; display: block; .flash-error { text-shadow: 0 -1px #838484; position: absolute; position: relative; } top: 11px; margin: 0 auto 15px; right: 12px; width: 435px; .flash-success { } border-radius: 5px; background: #1b942a; padding: 10px 50px 10px 15px; text-shadow: 0 -1px #1a7e1c; color: white; } font-weight: bold; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 144. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; background: #a4a4a4; display: block; margin: 0 auto 15px; text-shadow: 0 -1px #838484; position: absolute; width: 435px; } top: 11px; border-radius: 5px; right: 12px; padding: 10px 50px 10px 15px; .flash-success { } color: white; background: #1b942a; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 145. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; background: #a4a4a4; display: block; margin: 0 auto 15px; text-shadow: 0 -1px #838484; position: absolute; width: 435px; } top: 11px; border-radius: 5px; right: 12px; padding: 10px 50px 10px 15px; .flash-success { } color: white; background: #1b942a; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 146. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; @extend .flash-message; display: block; margin: 0 auto 15px; background: #a4a4a4; position: absolute; width: 435px; text-shadow: 0 -1px #838484; top: 11px; border-radius: 5px; } right: 12px; padding: 10px 50px 10px 15px; } color: white; .flash-success { font-weight: bold; @extend .flash-message; } background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 147. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; @extend .flash-message; display: block; margin: 0 auto 15px; background: #a4a4a4; position: absolute; width: 435px; text-shadow: 0 -1px #838484; top: 11px; border-radius: 5px; } right: 12px; padding: 10px 50px 10px 15px; } color: white; .flash-success { font-weight: bold; @extend .flash-message; } background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 148. Generated CSS .flash-message, .flash-info { .flash-icon { .flash-info, background: #a4a4a4; display: block; .flash-success, text-shadow: 0 -1px #838484; position: absolute; .flash-error { } top: 11px; position: relative; right: 12px; margin: 0 auto 15px; .flash-success { } width: 435px; background: #1b942a; border-radius: 5px; text-shadow: 0 -1px #1a7e1c; padding: 10px 50px 10px 15px; } color: white; font-weight: bold; .flash-error { } background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 151. Nesting • group styles together • avoid duplication of selectors
  • 152. Nesting • group styles together • avoid duplication of selectors • keep your code DRY
  • 153. Nesting • group styles together • avoid duplication of selectors • keep your code DRY Sass nesting ≠ html structure
  • 154. Nesting FASTER • group styles together • avoid duplication of selectors TRAFFIC • keep your code DRY KEEP Sass nesting ≠ html structure LEFT
  • 156. Warning about Nesting .subset-section background-color: #FFF width: 960px .subset-skus width: 790px .subset-selection float: left width: 790px .registrant-needs margin-bottom: 10px text-align: right .subset-attributes width: 430px float: left .subset-pricing display: block text-align: right .price-special font-size: 11px .currency font-size: 16px
  • 158. Warning about Nesting .subset-section { background-color: white; width: 960px; } .subset-section .subset-skus { width: 790px; } .subset-section .subset-skus .subset-selection { float: left; width: 790px; } .subset-section .subset-skus .subset-selection .registrant-needs { margin-bottom: 10px; text-align: right; } .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes { width: 430px; float: left; } .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-pricing display: block; text-align: right; } .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-prici font-size: 11px; } .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-prici font-size: 16px; }
  • 159. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; @extend .flash-message; display: block; margin: 0 auto 15px; background: #a4a4a4; position: absolute; width: 435px; text-shadow: 0 -1px #838484; top: 11px; border-radius: 5px; } right: 12px; padding: 10px 50px 10px 15px; } color: white; .flash-success { font-weight: bold; @extend .flash-message; } background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 160. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; @extend .flash-message; display: block; margin: 0 auto 15px; background: #a4a4a4; position: absolute; width: 435px; text-shadow: 0 -1px #838484; top: 11px; border-radius: 5px; } right: 12px; padding: 10px 50px 10px 15px; } color: white; .flash-success { font-weight: bold; @extend .flash-message; } background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; }
  • 161. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; @extend .flash-message; display: block; margin: 0 auto 15px; background: #a4a4a4; position: absolute; width: 435px; text-shadow: 0 -1px #838484; top: 11px; border-radius: 5px; } right: 12px; padding: 10px 50px 10px 15px; } color: white; .flash-success { font-weight: bold; @extend .flash-message; } background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; .flash-error li { font-weight: normal; } }
  • 162. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; @extend .flash-message; display: block; margin: 0 auto 15px; background: #a4a4a4; position: absolute; width: 435px; text-shadow: 0 -1px #838484; top: 11px; border-radius: 5px; } right: 12px; padding: 10px 50px 10px 15px; } color: white; .flash-success { font-weight: bold; @extend .flash-message; } background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; .flash-error li { font-weight: normal; } }
  • 163. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; @extend .flash-message; display: block; margin: 0 auto 15px; background: #a4a4a4; position: absolute; width: 435px; text-shadow: 0 -1px #838484; top: 11px; border-radius: 5px; } right: 12px; padding: 10px 50px 10px 15px; } color: white; .flash-success { font-weight: bold; @extend .flash-message; } background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; li { font-weight: normal; } }
  • 164. .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-icon { display: block; .flash-success { position: absolute; background: #1b942a; top: 11px; text-shadow: 0 -1px #1a7e1c; } right: 12px; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } screen.css
  • 165. .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-icon { display: block; .flash-success { position: absolute; background: #1b942a; top: 11px; text-shadow: 0 -1px #1a7e1c; } right: 12px; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } output_style = :nested screen.css
  • 166. .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-icon { display: block; .flash-success { position: absolute; background: #1b942a; top: 11px; text-shadow: 0 -1px #1a7e1c; } right: 12px; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } output_style = :nested screen.css
  • 167. .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } output_style .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-icon { display: block; .flash-success { position: absolute; background: #1b942a; top: 11px; text-shadow: 0 -1px #1a7e1c; } right: 12px; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } output_style = :nested screen.css
  • 168. .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; .flash-icon { text-shadow: 0 -1px #838484; display: block; } position: absolute; top: 11px; .flash-success { right: 12px; background: #1b942a; } text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; output_style = :expanded screen.css } .flash-error li { font-weight: normal; }
  • 169. .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } output_style = :compact screen.css
  • 170. .flash-message,.flash-info,.flash-success,.flash-error{position:relative;margin:0 auto 15px;width: 435px;border-radius:5px;padding:10px 50px 10px 15px;color:white;font-weight:bold}.flash- info{background:#a4a4a4;text-shadow:0 -1px #838484}.flash-success{background:#1b942a;text-shadow:0 -1px #1a7e1c}.flash-error{background:#ef9000;text-shadow:0 -1px #e8541c}.flash-error li{font- weight:normal}.flash-icon{display:block;position:absolute;top:11px;right:12px} output_style = :compressed screen.css
  • 172. _messaging.scss .flash-message { .flash-info { .flash-icon { position: relative; @extend .flash-message; display: block; margin: 0 auto 15px; background: #a4a4a4; position: absolute; width: 435px; text-shadow: 0 -1px #838484; top: 11px; border-radius: 5px; } right: 12px; padding: 10px 50px 10px 15px; } color: white; .flash-success { font-weight: bold; @extend .flash-message; } background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; li { font-weight: normal; } }
  • 173. _messaging.sass .flash-message .flash-info .flash-icon position: relative @extend .flash-message display: block margin: 0 auto 15px; background: #a4a4a4 position: absolute width: 435px; text-shadow: 0 -1px #838484 top: 11px border-radius: 5px right: 12px padding: 10px 50px 10px 15px .flash-success color: white @extend .flash-message font-weight: bold background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal
  • 174. _messaging.sass .flash-message .flash-info .flash-icon position: relative @extend .flash-message display: block margin: 0 auto 15px; background: #a4a4a4 position: absolute width: 435px; text-shadow: 0 -1px #838484 top: 11px border-radius: 5px right: 12px padding: 10px 50px 10px 15px .flash-success color: white @extend .flash-message font-weight: bold background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal
  • 176. screen.scss @import "compass/reset"; @import "layout"; @import "messaging"; @import supports both syntaxes, no changes here
  • 178. screen.sass @import compass/reset @import layout @import messaging semicolons removed, quotes optional
  • 181. $variables • containers for values • variable name define the purpose of values
  • 182. $variables • containers for values • variable name define the purpose of values • Five value types in Sass:
  • 183. $variables • containers for values • variable name define the purpose of values • Five value types in Sass: • numbers: 5, 8.2, 99%, 20px
  • 184. $variables • containers for values • variable name define the purpose of values • Five value types in Sass: • numbers: 5, 8.2, 99%, 20px • text strings: foo bar, “baz qux”
  • 185. $variables • containers for values • variable name define the purpose of values • Five value types in Sass: • numbers: 5, 8.2, 99%, 20px • text strings: foo bar, “baz qux” • colors: #38e1b2, rgba(0, 128, 255, 0.3)
  • 186. $variables • containers for values • variable name define the purpose of values • Five value types in Sass: • numbers: 5, 8.2, 99%, 20px • text strings: foo bar, “baz qux” • colors: #38e1b2, rgba(0, 128, 255, 0.3) • booleans: true or false
  • 187. $variables • containers for values • variable name define the purpose of values • Five value types in Sass: • numbers: 5, 8.2, 99%, 20px • text strings: foo bar, “baz qux” • colors: #38e1b2, rgba(0, 128, 255, 0.3) • booleans: true or false • lists: 2px 10px 15px or Arial, Helvetica, Courier
  • 188. _messaging.sass .flash-message .flash-info .flash-icon position: relative @extend .flash-message display: block margin: 0 auto 15px background: #a4a4a4 position: absolute width: 435px text-shadow: 0 -1px #838484 top: 11px border-radius: 5px right: 12px padding: 10px 50px 10px 15px .flash-success color: white @extend .flash-message font-weight: bold background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal
  • 189. _messaging.sass .flash-message .flash-info position: relative @extend .flash-message margin: 0 auto 15px background: #a4a4a4 width: 435px text-shadow: 0 -1px #838484 border-radius: 5px padding: 10px 50px 10px 15px .flash-success color: white @extend .flash-message font-weight: bold background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-icon display: block .flash-error position: absolute @extend .flash-message top: 11px background: #ef9000 right: 12px text-shadow: 0 -1px #e8541c li font-weight: normal
  • 190. _messaging.sass .flash-message .flash-info position: relative @extend .flash-message margin: 0 auto 15px background: #a4a4a4 width: 435px text-shadow: 0 -1px #838484 border-radius: 5px padding: 10px 50px 10px 15px .flash-success color: white @extend .flash-message font-weight: bold background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-icon display: block .flash-error position: absolute @extend .flash-message top: 11px background: #ef9000 right: 12px text-shadow: 0 -1px #e8541c li font-weight: normal
  • 191. _messaging.sass $flash-info-background: #a4a4a4 .flash-info $flash-info-text-shadow: #838484 @extend .flash-message $flash-success-background: #1b942a background: #a4a4a4 $flash-success-text-shadow: #1a7e1c text-shadow: 0 -1px #838484 $flash-error-background: #ef9000 $flash-error-text-shadow: #e8541c .flash-success @extend .flash-message .flash-message background: #1b942a position: relative text-shadow: 0 -1px #1a7e1c margin: 0 auto 15px width: 435px .flash-error border-radius: 5px @extend .flash-message padding: 10px 50px 10px 15px background: #ef9000 color: white text-shadow: 0 -1px #e8541c font-weight: bold li font-weight: normal .flash-icon display: block position: absolute top: 11px right: 12px
  • 192. _messaging.sass $flash-info-background: #a4a4a4 .flash-info $flash-info-text-shadow: #838484 @extend .flash-message $flash-success-background: #1b942a background: $flash-info-background $flash-success-text-shadow: #1a7e1c text-shadow: 0 -1px $flash-info-text-shadow $flash-error-background: #ef9000 $flash-error-text-shadow: #e8541c .flash-success @extend .flash-message .flash-message background: $flash-success-background position: relative text-shadow: 0 -1px $flash-success-text-shadow margin: 0 auto 15px width: 435px .flash-error border-radius: 5px @extend .flash-message padding: 10px 50px 10px 15px background: $flash-error-background color: white text-shadow: 0 -1px $flash-error-text-shadow font-weight: bold li font-weight: normal .flash-icon display: block position: absolute top: 11px right: 12px
  • 193. _messaging.sass $flash-info-background: #a4a4a4 .flash-info $flash-info-text-shadow: #838484 @extend .flash-message $flash-success-background: #1b942a background: $flash-info-background $flash-success-text-shadow: #1a7e1c text-shadow: 0 -1px $flash-info-text-shadow $flash-error-background: #ef9000 $flash-error-text-shadow: #e8541c .flash-success @extend .flash-message .flash-message background: $flash-success-background position: relative text-shadow: 0 -1px $flash-success-text-shadow margin: 0 auto 15px width: 435px .flash-error border-radius: 5px @extend .flash-message padding: 10px 50px 10px 15px background: $flash-error-background color: white text-shadow: 0 -1px $flash-error-text-shadow font-weight: bold li font-weight: normal .flash-icon display: block position: absolute top: 11px right: 12px
  • 194. _messaging.sass .flash-message .flash-info position: relative @extend .flash-message margin: 0 auto 15px background: $flash-info-background width: 435px text-shadow: 0 -1px $flash-info-text-shadow border-radius: 5px padding: 10px 50px 10px 15px .flash-success color: white @extend .flash-message font-weight: bold background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-icon display: block .flash-error position: absolute @extend .flash-message top: 11px background: $flash-error-background right: 12px text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal
  • 195. _config.sass partial Set all your site-wide values here.
  • 197. _config.sass $flash-info-background: #a4a4a4 $flash-info-text-shadow: #838484 $flash-success-background: #1b942a $flash-success-text-shadow: #1a7e1c $flash-error-background: #ef9000 $flash-error-text-shadow: #e8541c
  • 198. _config.sass $flash-info-background: #a4a4a4 $flash-info-text-shadow: #838484 $flash-success-background: #1b942a $flash-success-text-shadow: #1a7e1c $flash-error-background: #ef9000 $flash-error-text-shadow: #e8541c screen.sass @import compass/reset @import layout @import messaging
  • 199. _config.sass $flash-info-background: #a4a4a4 $flash-info-text-shadow: #838484 $flash-success-background: #1b942a $flash-success-text-shadow: #1a7e1c $flash-error-background: #ef9000 $flash-error-text-shadow: #e8541c screen.sass @import config @import compass/reset @import layout @import messaging
  • 200. Math
  • 201. Math Just like in algebra class, show your work.
  • 202. Math Just like in algebra class, show your work. • Replace arbitrary numbers with calculations.
  • 203. Math Just like in algebra class, show your work. • Replace arbitrary numbers with calculations. • Control your grid styles
  • 204. Math Just like in algebra class, show your work. • Replace arbitrary numbers with calculations. • Control your grid styles • Document logic in your styles
  • 205. _messaging.sass .flash-message position: relative margin: 0 auto 15px width: 435px border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  • 206. _messaging.sass .flash-message position: relative margin: 0 auto 15px width: 435px border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  • 207. _messaging.sass $flash-message-width: 500px .flash-message position: relative width: 435px border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  • 208. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px .flash-message position: relative width: 435px border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  • 209. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message position: relative width: 435px border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  • 210. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  • 211. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px $flash-message-h-padding + $flash-message-icon-padding 10px $flash-message-h-padding color: white font-weight: bold
  • 212. @mixin(argument) A reusable block of content, usually with arguments.
  • 213. _messaging.sass .flash-info @extend .flash-message background: $flash-info-background text-shadow: 0 -1px $flash-info-text-shadow .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal
  • 214. _messaging.sass .flash-info @extend .flash-message background: $flash-info-background see text-shadow: 0 -1px $flash-info-text-shadow .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal
  • 215. _messaging.sass .flash-info @extend .flash-message background: $flash-info-background see text-shadow: 0 -1px $flash-info-text-shadow .flash-success @extend .flash-message background: $flash-success-background the text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal
  • 216. _messaging.sass .flash-info @extend .flash-message background: $flash-info-background see text-shadow: 0 -1px $flash-info-text-shadow .flash-success @extend .flash-message background: $flash-success-background the text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow pattern? li font-weight: normal
  • 217. _messaging.sass @mixin flash-message($type, $background, $text-shadow) .flash-#{$type} @extend .flash-message background: $background text-shadow: 0 -1px $text-shadow @if $type == error li font-weight: normal
  • 218. _messaging.sass @mixin flash-message($type, $background, $text-shadow) .flash-#{$type} @extend .flash-message background: $background text-shadow: 0 -1px $text-shadow @if $type == error li font-weight: normal @include flash-message(info, $flash-info-background, $flash-info-text-shadow) @include flash-message(success, $flash-success-background, $flash-success-text-shadow) @include flash-message(error, $flash-error-background, $flash-error-text-shadow)
  • 219. _messaging.sass =flash-message($type, $background, $text-shadow) .flash-#{$type} @extend .flash-message background: $background text-shadow: 0 -1px $text-shadow @if $type == error li font-weight: normal +flash-message(info, $flash-info-background, $flash-info-text-shadow) +flash-message(success, $flash-success-background, $flash-success-text-shadow) +flash-message(error, $flash-error-background, $flash-error-text-shadow)
  • 221. Sprites Surprisingly simple with Compass error.png
  • 222. Sprites Surprisingly simple with Compass error.png info.png
  • 223. Sprites Surprisingly simple with Compass error.png info.png success.png
  • 224. Sprites Surprisingly simple with Compass error.png info.png success.png
  • 225. Sprites Surprisingly simple with Compass error.png info.png icon-s5c33447329.png success.png
  • 226.
  • 227. create folder of images to sprite
  • 228. place images in folder
  • 230. _messaging.sass .flash-icon display: block position: absolute top: 11px right: 12px
  • 231. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px
  • 232. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px @import "icon/*.png" +all-icon-sprites
  • 233. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px $icon-sprite-dimensions: true @import "icon/*.png" +all-icon-sprites
  • 234. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px $icon-sprite-dimensions: true @import "icon/*.png" +all-icon-sprites
  • 235. _messaging.sass .icon-sprite display: block Compass config file position: absolute top: 11px right: 12px $icon-sprite-dimensions: true @import "icon/*.png" +all-icon-sprites
  • 236. _messaging.sass .icon-sprite display: block Compass config file position: absolute top: 11px right: 12px $icon-sprite-dimensions: true @import "icon/*.png" +all-icon-sprites config.rb http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" output_style = :nested relative_assets = true line_comments = false
  • 237. _messaging.sass .icon-sprite display: block Compass config file position: absolute top: 11px right: 12px $icon-sprite-dimensions: true @import "icon/*.png" +all-icon-sprites config.rb http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" output_style = :nested relative_assets = true line_comments = false
  • 238. _messaging.sass .icon-sprite display: block Compass config file position: absolute top: 11px right: 12px $icon-sprite-dimensions: true @import "icon/*.png" +all-icon-sprites
  • 239. _messaging.sass .icon-sprite display: block Compass config file position: absolute top: 11px right: 12px $icon-sprite-dimensions: true @import "icon/*.png" generated sprite +all-icon-sprites icon-s5c33447329.png
  • 240. Compiled sprite CSS .icon-sprite, .icon-error, .icon-info, .icon-success { display: block; position: absolute; top: 11px; right: 12px; } .icon-sprite, .icon-error, .icon-info, .icon-success { background: url('../images/icon-sa3bc8b9105.png') no-repeat; } .icon-error { .icon-info { .icon-success { background-position: 0 0; background-position: 0 -19px; background-position: 0 -40px; height: 19px; height: 21px; height: 21px; width: 20px; } width: 20px; } width: 20px; }

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  58. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  59. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  60. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  61. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  62. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  63. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  64. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  65. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  66. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  67. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  68. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  69. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  70. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  71. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  72. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  73. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  74. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  75. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  76. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  77. DRY: Concept\n- Every piece of knowledge\n- should have a single representation\n- within a system\n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. \n
  136. \n
  137. \n
  138. \n
  139. \n
  140. \n
  141. \n
  142. \n
  143. \n
  144. \n
  145. \n
  146. \n
  147. \n
  148. \n
  149. \n
  150. \n
  151. \n
  152. \n
  153. \n
  154. \n
  155. \n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n
  161. \n
  162. \n
  163. \n
  164. \n
  165. \n
  166. \n
  167. \n
  168. \n
  169. \n
  170. \n
  171. \n
  172. \n
  173. \n
  174. \n
  175. \n
  176. \n
  177. \n
  178. \n
  179. \n
  180. \n
  181. \n
  182. \n
  183. \n
  184. \n
  185. \n
  186. \n
  187. \n
  188. \n
  189. \n
  190. \n
  191. \n
  192. \n
  193. \n
  194. \n
  195. \n
  196. \n
  197. \n
  198. \n
  199. \n
  200. \n
  201. \n
  202. \n
  203. \n
  204. \n
  205. \n
  206. \n
  207. \n
  208. \n
  209. \n
  210. \n
  211. \n
  212. \n
  213. \n
  214. \n
  215. \n
  216. \n
  217. \n
  218. \n
  219. \n
  220. \n
  221. \n
  222. \n
  223. \n
  224. \n
  225. \n
  226. \n
  227. \n
  228. \n
  229. \n
  230. \n
  231. \n
  232. \n
  233. \n
  234. \n
  235. \n
  236. \n
  237. \n
  238. \n
  239. \n
  240. \n
  241. \n
  242. \n
  243. \n
  244. \n
  245. \n
  246. \n
  247. \n
  248. \n
  249. \n
  250. \n
  251. \n
  252. \n
  253. \n
  254. \n
  255. \n
  256. \n
  257. \n
  258. \n
  259. \n
  260. \n
  261. \n
  262. \n
  263. \n
  264. \n
  265. \n
  266. \n
  267. \n
  268. \n
  269. \n
  270. \n
  271. \n
  272. \n
  273. \n
  274. \n
  275. \n
  276. \n
  277. \n
  278. \n
  279. \n
  280. \n
  281. \n
  282. \n
  283. \n
  284. \n
  285. \n
  286. \n
  287. \n
  288. \n
  289. \n
  290. \n
  291. \n
  292. \n
  293. \n
  294. \n
  295. \n
  296. \n
  297. \n
  298. \n
  299. \n
  300. \n
  301. \n
  302. \n
  303. \n
  304. \n
  305. \n
  306. \n
  307. \n
  308. \n
  309. \n
  310. \n
  311. \n
  312. \n
  313. \n
  314. \n
  315. \n
  316. \n
  317. \n
  318. \n
  319. \n
  320. \n
  321. \n
  322. \n