SlideShare uma empresa Scribd logo
1 de 17
HTTP://WWW.VIRTUAL-CALL-CENTER.EU/




   LESS and other CSS
     preprocessors


                         Farkas Máté
     Frontend meetup #11, 2012-08-07
What’s wrong with CSS?


.my-module   a { /*...*/ }
.my-module   a:hover { /*...*/ }
.my-module   strong { /*...*/ }
.my-module   p.em { /*...*/ }
.my-module   p.em em { /*...*/ }
What’s wrong with CSS?


.my-module   a { /*...*/ }
.my-module   a:hover { /*...*/ }
.my-module   strong { /*...*/ }
.my-module   p.em { /*...*/ }
.my-module   p.em em { /*...*/ }

                   verbose,
                   primitive
What’s wrong with CSS?


.content {
  border-radius: ...
  -*-border-radius: ...
}
.sidebar {
  border-radius: ...
  -*-border-radius: ...
}
What’s wrong with CSS?


.content {
  border-radius: ...
  -*-border-radius: ...
}                    Must repeat
.sidebar {             yourself
  border-radius: ...
  -*-border-radius: ...
}
CSS preprocessors


- LESS

- SASS

- Stylus
Saying


- LESS The dynamic stylesheet
  language
- SASS Syntactically Awsome
  CSS (Sass makes CSS fun again)
- Stylus Expressive, dynamic,
  robust CSS
Runs on…


- LESS JavaScript (Node.js,
  Rhino, FF, Chrome, Safari…)
- SASS Ruby gem

- Stylus Node.js
Syntax


- LESS CSS-like syntax

- SASS both CSS-like (SCSS)
  and new (SASS) syntax
- Stylus new syntax (optional)
Syntax highlight


- LESS Komodo (tested by me)

- SASS

- Stylus Textmate bundle
  (official)
Other possible comparisons


- Error reporting
- Speed, optimalizations
- Size of the compiled code
- Predefined classes & mixins
Why LESS?


- CSS-like syntax:
  easy to migrate
- JavaScript:
  everything is in the hand
Why LESS?


- CSS-like syntax:
  easy to migrate
- JavaScript:
  everything is in the hand
       But we must compile
         styles from now
Variables & functions


@defaultSize: 12px;
@emColor: #999;
p { font-size: @defaultSize; }
em { color: @emColor; }
quote {
  font-size: @defaultSize * 1.2;
  color: lighten(@emColor, 15%);
}
Mixins


.rounded(@radius: 5px) {
  border-radius: @radius
  /*...*/
}

.sidebar-box { .rounded; }
.main-box { .rounded(3em); }
Nested rules


.my-module {
    ...
    a { ...
        &:hover { ... }
    }
    strong { ... }
}
Questions & Links

About the presenter:
http://www.virtual-call-center.hu/
http://farkas-mate.hu/




                                       ?
Preprocessors:
http://lesscss.org/
http://sass-lang.com/
http://learnboost.github.com/stylus/

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Challenges of angular in production (Tasos Bekos) - GreeceJS #17Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
 
Node JS
Node JSNode JS
Node JS
 
MVVM Windows UWP apps with Template 10
MVVM Windows UWP apps with Template 10MVVM Windows UWP apps with Template 10
MVVM Windows UWP apps with Template 10
 
Metarefresh
MetarefreshMetarefresh
Metarefresh
 
Less css
Less cssLess css
Less css
 
Blazor and azure functions for serverless websites
Blazor and azure functions for serverless websitesBlazor and azure functions for serverless websites
Blazor and azure functions for serverless websites
 
Implementando rapidamente web apps com blazor e serverless
Implementando rapidamente web apps com blazor e serverlessImplementando rapidamente web apps com blazor e serverless
Implementando rapidamente web apps com blazor e serverless
 
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
EasyEngine - Command-Line tool to manage WordPress Sites on NginxEasyEngine - Command-Line tool to manage WordPress Sites on Nginx
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
 
Debugging WordPress Performance using EasyEngine
Debugging WordPress Performance using EasyEngineDebugging WordPress Performance using EasyEngine
Debugging WordPress Performance using EasyEngine
 
How to Build a Bespoke Page Builder in WordPress
How to Build a Bespoke Page Builder in WordPressHow to Build a Bespoke Page Builder in WordPress
How to Build a Bespoke Page Builder in WordPress
 
Running with emmet and scss
Running with emmet  and scssRunning with emmet  and scss
Running with emmet and scss
 
Introducing MongoBase
Introducing MongoBaseIntroducing MongoBase
Introducing MongoBase
 
Krishan gaurav-sapient bootstrapsession
Krishan gaurav-sapient bootstrapsessionKrishan gaurav-sapient bootstrapsession
Krishan gaurav-sapient bootstrapsession
 
The Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookThe Future is Modular, Jonathan Snook
The Future is Modular, Jonathan Snook
 
20111129 modernizr
20111129 modernizr20111129 modernizr
20111129 modernizr
 
Memcached And MySQL
Memcached And MySQLMemcached And MySQL
Memcached And MySQL
 
LESS, the CSS Preprocessor
LESS, the CSS PreprocessorLESS, the CSS Preprocessor
LESS, the CSS Preprocessor
 
Using LESS, the CSS Preprocessor: J and Beyond 2013
Using LESS, the CSS Preprocessor: J and Beyond 2013Using LESS, the CSS Preprocessor: J and Beyond 2013
Using LESS, the CSS Preprocessor: J and Beyond 2013
 
Sass presentation
Sass presentationSass presentation
Sass presentation
 
Web03
Web03Web03
Web03
 

Destaque

2015 deep market research report on global purified terephthalic acid industry
2015 deep market research report on global purified terephthalic acid industry2015 deep market research report on global purified terephthalic acid industry
2015 deep market research report on global purified terephthalic acid industry
Research Hub
 
El mundo subdesarrollado
El mundo subdesarrolladoEl mundo subdesarrollado
El mundo subdesarrollado
Mercedes Díaz
 

Destaque (12)

Note making and note taking pract
Note making and note taking practNote making and note taking pract
Note making and note taking pract
 
Többszálú javascript
Többszálú javascriptTöbbszálú javascript
Többszálú javascript
 
2015 deep market research report on global purified terephthalic acid industry
2015 deep market research report on global purified terephthalic acid industry2015 deep market research report on global purified terephthalic acid industry
2015 deep market research report on global purified terephthalic acid industry
 
Allarangen fiber infomöte 3 september 2015
Allarangen fiber infomöte 3 september 2015Allarangen fiber infomöte 3 september 2015
Allarangen fiber infomöte 3 september 2015
 
Dokumentáljunk, de hogyan?
Dokumentáljunk, de hogyan?Dokumentáljunk, de hogyan?
Dokumentáljunk, de hogyan?
 
What Do "Cage-Free" and "Free-Range" Egg Labels Mean?
What Do "Cage-Free" and "Free-Range" Egg Labels Mean? What Do "Cage-Free" and "Free-Range" Egg Labels Mean?
What Do "Cage-Free" and "Free-Range" Egg Labels Mean?
 
Flight of passion
Flight of passionFlight of passion
Flight of passion
 
Conoscere il percorso del Nordic Walking Park di Brenzone sul Garda
Conoscere il percorso del Nordic Walking Park di Brenzone sul GardaConoscere il percorso del Nordic Walking Park di Brenzone sul Garda
Conoscere il percorso del Nordic Walking Park di Brenzone sul Garda
 
Servicio de desarrollo de Apps para iPhone, Android y Kindle ofrecido por App...
Servicio de desarrollo de Apps para iPhone, Android y Kindle ofrecido por App...Servicio de desarrollo de Apps para iPhone, Android y Kindle ofrecido por App...
Servicio de desarrollo de Apps para iPhone, Android y Kindle ofrecido por App...
 
Proyecto escuela comunidad
Proyecto escuela comunidadProyecto escuela comunidad
Proyecto escuela comunidad
 
Osztályozzunk!
Osztályozzunk!Osztályozzunk!
Osztályozzunk!
 
El mundo subdesarrollado
El mundo subdesarrolladoEl mundo subdesarrollado
El mundo subdesarrollado
 

Semelhante a CSS előfeldolgozók

SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren
 
Dallas Drupal Days 2012 - Introduction to less sass-compass
Dallas Drupal Days 2012  - Introduction to less sass-compassDallas Drupal Days 2012  - Introduction to less sass-compass
Dallas Drupal Days 2012 - Introduction to less sass-compass
Chris Lee
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
Zeeshan Ahmed
 

Semelhante a CSS előfeldolgozók (20)

SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
 
Dallas Drupal Days 2012 - Introduction to less sass-compass
Dallas Drupal Days 2012  - Introduction to less sass-compassDallas Drupal Days 2012  - Introduction to less sass-compass
Dallas Drupal Days 2012 - Introduction to less sass-compass
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)
 
Create SASSy web parts in SPFx
Create SASSy web parts in SPFxCreate SASSy web parts in SPFx
Create SASSy web parts in SPFx
 
[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX
 
LESS : The dynamic stylesheet language
LESS : The dynamic stylesheet languageLESS : The dynamic stylesheet language
LESS : The dynamic stylesheet language
 
Stop your share point css become a di-sass-ter today - SPS Munich
Stop your share point css become a di-sass-ter today - SPS MunichStop your share point css become a di-sass-ter today - SPS Munich
Stop your share point css become a di-sass-ter today - SPS Munich
 
Create SASSY Web Parts - SPSMilan
Create SASSY Web Parts - SPSMilan Create SASSY Web Parts - SPSMilan
Create SASSY Web Parts - SPSMilan
 
CSS Preprocessors: LESS is more or look SASS-y trying
CSS Preprocessors: LESS is more or look SASS-y tryingCSS Preprocessors: LESS is more or look SASS-y trying
CSS Preprocessors: LESS is more or look SASS-y trying
 
Advanced sass
Advanced sassAdvanced sass
Advanced sass
 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
 
CSS3
CSS3CSS3
CSS3
 
Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 
CSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsCSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and Cons
 
Fasten RWD Development with Sass
Fasten RWD Development with SassFasten RWD Development with Sass
Fasten RWD Development with Sass
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
Workshop 17: EmberJS parte II
Workshop 17: EmberJS parte IIWorkshop 17: EmberJS parte II
Workshop 17: EmberJS parte II
 
SASS for WordPress Workshop
SASS for WordPress WorkshopSASS for WordPress Workshop
SASS for WordPress Workshop
 

Mais de Máté Farkas (8)

Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Git és/vagy Subversion
Git és/vagy SubversionGit és/vagy Subversion
Git és/vagy Subversion
 
Egyszálú JavaScript
Egyszálú JavaScriptEgyszálú JavaScript
Egyszálú JavaScript
 
ECMAScript 5 Classes
ECMAScript 5 ClassesECMAScript 5 Classes
ECMAScript 5 Classes
 
Use strict
Use strictUse strict
Use strict
 
IEEE-754
IEEE-754IEEE-754
IEEE-754
 
Automatikus pontosvessző beszúrás a JavaScriptben
Automatikus pontosvessző beszúrás a JavaScriptbenAutomatikus pontosvessző beszúrás a JavaScriptben
Automatikus pontosvessző beszúrás a JavaScriptben
 
CSS előfeldolgozók
CSS előfeldolgozókCSS előfeldolgozók
CSS előfeldolgozók
 

CSS előfeldolgozók

  • 1. HTTP://WWW.VIRTUAL-CALL-CENTER.EU/ LESS and other CSS preprocessors Farkas Máté Frontend meetup #11, 2012-08-07
  • 2. What’s wrong with CSS? .my-module a { /*...*/ } .my-module a:hover { /*...*/ } .my-module strong { /*...*/ } .my-module p.em { /*...*/ } .my-module p.em em { /*...*/ }
  • 3. What’s wrong with CSS? .my-module a { /*...*/ } .my-module a:hover { /*...*/ } .my-module strong { /*...*/ } .my-module p.em { /*...*/ } .my-module p.em em { /*...*/ } verbose, primitive
  • 4. What’s wrong with CSS? .content { border-radius: ... -*-border-radius: ... } .sidebar { border-radius: ... -*-border-radius: ... }
  • 5. What’s wrong with CSS? .content { border-radius: ... -*-border-radius: ... } Must repeat .sidebar { yourself border-radius: ... -*-border-radius: ... }
  • 7. Saying - LESS The dynamic stylesheet language - SASS Syntactically Awsome CSS (Sass makes CSS fun again) - Stylus Expressive, dynamic, robust CSS
  • 8. Runs on… - LESS JavaScript (Node.js, Rhino, FF, Chrome, Safari…) - SASS Ruby gem - Stylus Node.js
  • 9. Syntax - LESS CSS-like syntax - SASS both CSS-like (SCSS) and new (SASS) syntax - Stylus new syntax (optional)
  • 10. Syntax highlight - LESS Komodo (tested by me) - SASS - Stylus Textmate bundle (official)
  • 11. Other possible comparisons - Error reporting - Speed, optimalizations - Size of the compiled code - Predefined classes & mixins
  • 12. Why LESS? - CSS-like syntax: easy to migrate - JavaScript: everything is in the hand
  • 13. Why LESS? - CSS-like syntax: easy to migrate - JavaScript: everything is in the hand But we must compile styles from now
  • 14. Variables & functions @defaultSize: 12px; @emColor: #999; p { font-size: @defaultSize; } em { color: @emColor; } quote { font-size: @defaultSize * 1.2; color: lighten(@emColor, 15%); }
  • 15. Mixins .rounded(@radius: 5px) { border-radius: @radius /*...*/ } .sidebar-box { .rounded; } .main-box { .rounded(3em); }
  • 16. Nested rules .my-module { ... a { ... &:hover { ... } } strong { ... } }
  • 17. Questions & Links About the presenter: http://www.virtual-call-center.hu/ http://farkas-mate.hu/ ? Preprocessors: http://lesscss.org/ http://sass-lang.com/ http://learnboost.github.com/stylus/