LESS & Sass
Overview
How to START with
Client-side way
Download less.js      Create style.less file
http://lesscss.org/   Instead of style.css
Link both files with the main HTML doc

          <link rel="stylesheet/less" href="styles.less" />




          <script src="less.js" ></script>
Server-side way
First possibility               Second possibility
Download NPM                    Download Ruby
                                http://www.ruby-lang.org/en/downloads
https://github.com/isaacs/npm


Or get Node.js                  For Windows users
http://nodejs.org/              http://rubyinstaller.org



 Now start the command prompt
If you chose NPM type:




 $ npm install -g less
If you chose Ruby type:




 $ gem install less
How to compile the Less code?
Client-side way
     It happens automatically when you hit (F5).
     You could also use some compilation tools.


Server-side way
     $ lessc style.less > style.css


   Less compiler          Output Css file

              Less file
LESS Compilers
Remember the client-side way, well this is pretty
much the same, but we have tools to help us.




 simpLess           CodeKit           LiveReload
How to START with
Just Server-side way   (there are dome unofficial client side ways)




   $ gem install sass
How to compile the Sass code?
Server-side way
       $ sass --watch style.scss : style.css


Sass compiler

      Watch for compilation


                        SASS code file   CSS code file
Less & Sass comparison
Variables
   just a value container
Sometimes we repeat the same value
over and over
#firstElement {
          background: #abcdef
}
#secondElement {                 background: #abcdef
          background : #abcdef

}
#thirdElement {
         color : #ff91aa;
}
...                               color : #ff91aa
#nthElement {
         color : #ff91aa;
}
LESS                           SASS
@bgColor : #abcdef;             $bgColor : #abcdef;
@justColor : #ff91aa;           $justColor : #ff91aa;

#firstElement{                  #firstElement{
        background: @bgColor;           background: $bgColor;
}                               }
Mixins
  variables on steroids
Sometimes we repeat a big chinks of code
with different values over and over
#justElement {
       -moz-bordee-radius: 10px;
       -webkit-border-radius: 10px;
       -o-border-radius: 10px;
       border-radius: 10px;
}
#anotherElement {
       /* if we want the same*/
}
LESS                                SASS
.roundBorder( @val : 10px ) {      @roundBorder( $val : 10x) {
    -moz-bordee-radius: @val;         -moz-bordee-radius: $val;
    -webkit-border-radius: @val;      -webkit-border-radius: $val;
    -o-border-radius: @val;           -o-border-radius: $val;
    border-radius: @val;              border-radius: $val;
}                                  }

#justElement{                      #justElement{
        .roundBorder( );                   @include roundBorder()
}                                  }
#anatherElement{                   #anotherElement{
        .roundBorder(17px);                @include roundBorder(17px)
}                                  }
Nested css code
   no more epic repetition code
If we have a lot of nested content is tedious to
have address the deepest elements
<div id=“main”>                   #main {
     <p>                                    width:500px
         <span>Span text</span>   }
         <a href=“#”>Link</a>     #main p {
     </p>                                 width: 150px;
</div>                            }
                                  #main p span {
                                          color: #abcdef;
                                  }
                                  #main p a {
                                          text-decoration: none;
                                  }
LESS and SaSS
#main{
         width: 500px;                      FIRST LEVEL NESTING (P ELEMENT)
         p{
                 width: 150px;
                                                          SECOND LEVEL NESTING
                                                          Span element
                 span {
                          color: #abcdef;
                 }
                 a{                                       SECOND LEVEL NESTING
                                                          anchor element
                          text-decoration: none;
                 }
         }
}
Functions & Operations
             a way to do the math
Operations

LESS example                     Sass example

// width variable                // width variable
@width: 500px;                   $width : 500px;

#divNewWidth {                   #divNewWidth {
      width: (@width + 10)             width: ($width + 10);
}                                }


Both Sass and Less supports math operators(+|-|*|/|%).
Functions
Both Sass and Less supports a variety of Math
and Color functions, that generated specific css
values

Sass functions:
http://sasslang.com/docs/yardoc/Sass/Script/Functions.html
Less functions:
http://lesscss.org/#-color-functions

More Related Content

PPT
CSS Preprocessors: LESS is more or look SASS-y trying
PPTX
Write LESS. DO more.
PPT
Ruby on Rails
ODP
Introduction To Less
PDF
CSS Less framework overview, Pros and Cons
PPT
LESS(CSS preprocessor)
PPTX
Less css
PDF
Code rippa
CSS Preprocessors: LESS is more or look SASS-y trying
Write LESS. DO more.
Ruby on Rails
Introduction To Less
CSS Less framework overview, Pros and Cons
LESS(CSS preprocessor)
Less css
Code rippa

What's hot (20)

PDF
Less(CSS Pre Processor) Introduction
PDF
Perl in the Internet of Things
ODP
Sass presentation
ODP
HTML5, CSS, JavaScript Style guide and coding conventions
PPT
An Introduction to CSS Preprocessors (SASS & LESS)
PPTX
PostCss
PPTX
Css frameworks
PPTX
Software programming tools for creating/managing CSS files
PDF
Modern Web Development with Perl
ODP
Modern Perl
PPTX
Server Scripting Language -PHP
PDF
Preprocessor presentation
PPTX
API and DB design with Boolean
PDF
Building full-proof design tokens to support Kiwi.com's visual identity
PPTX
Doing More With Less
PPTX
KEY
Stylesheets of the future with Sass and Compass
PDF
Php converted pdf
Less(CSS Pre Processor) Introduction
Perl in the Internet of Things
Sass presentation
HTML5, CSS, JavaScript Style guide and coding conventions
An Introduction to CSS Preprocessors (SASS & LESS)
PostCss
Css frameworks
Software programming tools for creating/managing CSS files
Modern Web Development with Perl
Modern Perl
Server Scripting Language -PHP
Preprocessor presentation
API and DB design with Boolean
Building full-proof design tokens to support Kiwi.com's visual identity
Doing More With Less
Stylesheets of the future with Sass and Compass
Php converted pdf
Ad

Similar to Less & Sass (20)

PDF
Doing more with LESS
PDF
Sass and Compass - Getting Started
PDF
PDF
CSS Extenders
KEY
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
PDF
Getting Started with Sass & Compass
PDF
Compass And Sass(Tim Riley)
ODP
Cascading Style Sheets - Part 01
PPTX
SASS is more than LESS
KEY
Wrangling the CSS Beast with Sass
PDF
Compass, Sass, and the Enlightened CSS Developer
PDF
Accelerated Stylesheets
PDF
LESS
PDF
Sass - Making CSS fun again.
PDF
Do more with {less}
KEY
Drupal & CSS Preprocessors
PDF
Big Design Conference: CSS3
KEY
Using Sass - Building on CSS
PDF
CSS: The Boring Bits
KEY
BILL Hour: Try something new! (like Sass or Compass)
Doing more with LESS
Sass and Compass - Getting Started
CSS Extenders
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Getting Started with Sass & Compass
Compass And Sass(Tim Riley)
Cascading Style Sheets - Part 01
SASS is more than LESS
Wrangling the CSS Beast with Sass
Compass, Sass, and the Enlightened CSS Developer
Accelerated Stylesheets
LESS
Sass - Making CSS fun again.
Do more with {less}
Drupal & CSS Preprocessors
Big Design Conference: CSS3
Using Sass - Building on CSS
CSS: The Boring Bits
BILL Hour: Try something new! (like Sass or Compass)
Ad

More from Михаил Петров (11)

PDF
PDF
DOM API Java Script
PDF
Object - Oriented Java Script
PDF
strings and objects in JavaScript
PDF
Arrays and Functions in JavaScript
PDF
JavaScript intro
PPTX
Emmet(zen coding)
PPTX
Html 5 Semantics overview
PDF
PDF
Pseudo CSS Selectors
PDF
Науката през погледа на младите
DOM API Java Script
Object - Oriented Java Script
strings and objects in JavaScript
Arrays and Functions in JavaScript
JavaScript intro
Emmet(zen coding)
Html 5 Semantics overview
Pseudo CSS Selectors
Науката през погледа на младите

Recently uploaded (20)

PDF
Literature_Review_methods_ BRACU_MKT426 course material
PDF
Controlled Drug Delivery System-NDDS UNIT-1 B.Pharm 7th sem
PDF
Journal of Dental Science - UDMY (2022).pdf
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PDF
1.Salivary gland disease.pdf 3.Bleeding and Clotting Disorders.pdf important
PPT
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
PPTX
PLASMA AND ITS CONSTITUENTS 123.pptx
PPTX
Macbeth play - analysis .pptx english lit
PDF
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
PDF
Laparoscopic Colorectal Surgery at WLH Hospital
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
The TKT Course. Modules 1, 2, 3.for self study
PPTX
What’s under the hood: Parsing standardized learning content for AI
PDF
semiconductor packaging in vlsi design fab
PPTX
UNIT_2-__LIPIDS[1].pptx.................
PDF
Farming Based Livelihood Systems English Notes
PPTX
BSCE 2 NIGHT (CHAPTER 2) just cases.pptx
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
Literature_Review_methods_ BRACU_MKT426 course material
Controlled Drug Delivery System-NDDS UNIT-1 B.Pharm 7th sem
Journal of Dental Science - UDMY (2022).pdf
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
1.Salivary gland disease.pdf 3.Bleeding and Clotting Disorders.pdf important
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
PLASMA AND ITS CONSTITUENTS 123.pptx
Macbeth play - analysis .pptx english lit
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
Laparoscopic Colorectal Surgery at WLH Hospital
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
The TKT Course. Modules 1, 2, 3.for self study
What’s under the hood: Parsing standardized learning content for AI
semiconductor packaging in vlsi design fab
UNIT_2-__LIPIDS[1].pptx.................
Farming Based Livelihood Systems English Notes
BSCE 2 NIGHT (CHAPTER 2) just cases.pptx
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf

Less & Sass

  • 3. Client-side way Download less.js Create style.less file http://lesscss.org/ Instead of style.css
  • 4. Link both files with the main HTML doc <link rel="stylesheet/less" href="styles.less" /> <script src="less.js" ></script>
  • 5. Server-side way First possibility Second possibility Download NPM Download Ruby http://www.ruby-lang.org/en/downloads https://github.com/isaacs/npm Or get Node.js For Windows users http://nodejs.org/ http://rubyinstaller.org Now start the command prompt
  • 6. If you chose NPM type: $ npm install -g less
  • 7. If you chose Ruby type: $ gem install less
  • 8. How to compile the Less code? Client-side way It happens automatically when you hit (F5). You could also use some compilation tools. Server-side way $ lessc style.less > style.css Less compiler Output Css file Less file
  • 9. LESS Compilers Remember the client-side way, well this is pretty much the same, but we have tools to help us. simpLess CodeKit LiveReload
  • 10. How to START with
  • 11. Just Server-side way (there are dome unofficial client side ways) $ gem install sass
  • 12. How to compile the Sass code? Server-side way $ sass --watch style.scss : style.css Sass compiler Watch for compilation SASS code file CSS code file
  • 13. Less & Sass comparison
  • 14. Variables just a value container
  • 15. Sometimes we repeat the same value over and over #firstElement { background: #abcdef } #secondElement { background: #abcdef background : #abcdef } #thirdElement { color : #ff91aa; } ... color : #ff91aa #nthElement { color : #ff91aa; }
  • 16. LESS SASS @bgColor : #abcdef; $bgColor : #abcdef; @justColor : #ff91aa; $justColor : #ff91aa; #firstElement{ #firstElement{ background: @bgColor; background: $bgColor; } }
  • 17. Mixins variables on steroids
  • 18. Sometimes we repeat a big chinks of code with different values over and over #justElement { -moz-bordee-radius: 10px; -webkit-border-radius: 10px; -o-border-radius: 10px; border-radius: 10px; } #anotherElement { /* if we want the same*/ }
  • 19. LESS SASS .roundBorder( @val : 10px ) { @roundBorder( $val : 10x) { -moz-bordee-radius: @val; -moz-bordee-radius: $val; -webkit-border-radius: @val; -webkit-border-radius: $val; -o-border-radius: @val; -o-border-radius: $val; border-radius: @val; border-radius: $val; } } #justElement{ #justElement{ .roundBorder( ); @include roundBorder() } } #anatherElement{ #anotherElement{ .roundBorder(17px); @include roundBorder(17px) } }
  • 20. Nested css code no more epic repetition code
  • 21. If we have a lot of nested content is tedious to have address the deepest elements <div id=“main”> #main { <p> width:500px <span>Span text</span> } <a href=“#”>Link</a> #main p { </p> width: 150px; </div> } #main p span { color: #abcdef; } #main p a { text-decoration: none; }
  • 22. LESS and SaSS #main{ width: 500px; FIRST LEVEL NESTING (P ELEMENT) p{ width: 150px; SECOND LEVEL NESTING Span element span { color: #abcdef; } a{ SECOND LEVEL NESTING anchor element text-decoration: none; } } }
  • 23. Functions & Operations a way to do the math
  • 24. Operations LESS example Sass example // width variable // width variable @width: 500px; $width : 500px; #divNewWidth { #divNewWidth { width: (@width + 10) width: ($width + 10); } } Both Sass and Less supports math operators(+|-|*|/|%).
  • 25. Functions Both Sass and Less supports a variety of Math and Color functions, that generated specific css values Sass functions: http://sasslang.com/docs/yardoc/Sass/Script/Functions.html Less functions: http://lesscss.org/#-color-functions