SlideShare a Scribd company logo
A BETTER CSS : SASS & LESS
By Frédéric Ghijselinck & Sam Vloeberghs
Competence Center Front-end & UX
A BETTER CSS : SASS & LESS
I. What's wrong with CSS?
II. Introducing Sass
III. Introducing LESS
IV. Hands-on
I) WHAT'S WRONG WITH CSS
Browser incompatibilities
No functions / logic
No variables
Uncustomizable frameworks
DRY ..
SASS;CSSWITHSUPERPOWERS
Sass
Sass is the most mature, stable, and powerful professional grade CSS
extension language in the world.
II) INTRODUCING SASS
CSS Compatible
Feature rich
Mature
Large community
Framework adaption
Examples explained using a Sass variant, Scss
MULTIPLE COMPILERS
Compass
Libsass
CSS EXTENSIONS
Variables
Nested rules & properties
Referencing parent selectors
Functions
Interpolation
Variable defaults
...
SASS: VARIABLES
$success-color: #43AC6A;
$warning-color: #f08a24;
$linkcolor: $warning-color;
$otherlinkcolor: $success-color;
SASS: NESTED RULES & PROPERTIES
h1{
margin-bottom:15px;
font: {
size: 1.4em;
weight: bold;
}
}
h2{
margin-bottom:15px;
font: {
size: 1.2em;
weight: bold;
}
}
SASS: REFERENCING PARENT SELECTORS
a{
color:$linkcolor;
text-decoration:none;
&:hover{
border-bottom: 1px solid $linkcolor;
}
}
SASS: FUNCTIONS
$p_color: $primary-color;
p{
content: 'This is a paragraph';
color: $p_color;
padding:10px;
border: 2px solid $p_color;
&.darker{
$d_color: darken($color: $p_color, $amount: 10%);
color: $d_color;
border-color: $d_color;
}
&.lighter{
$l_color: lighten($amount: 30%, $color: $p_color);
color: $l_color;
border-color: $l_color;
}
}
SASS: INTERPOLATION
$name: fancy;
$attr: font;
p.#{$name} {
#{$attr}-color: blue;
}
SASS: VARIABLE DEFAULTS
$content: "First content";
$content: "Second content?" !default;
$bis_content: "First bis content" !default;
p {
margin-bottom:10px;
&.primary:before {
content: $content;
}
&.secundary:before {
content: $bis_content;
}
}
@-RULES & DIRECTIVES
Importing & partials
Media queries
Extending / inheriting
Mixins & arguments
Control directives, logic & expressions
SASS: IMPORTING & PARTIALS
@import "reset";
@import "settings";
@import "utils";
@import "styles";
@import "foo.css";
@import "foo" screen;
@import "http://foo.com/bar";
@import url(foo);
SASS: MEDIA QUERIES
.vierkant{
height:150px; text-align:center;
color:#fff; font-weight:bold;
span{ display:none; }
@media #{$small-only} {
background: blue;
span.small{ display:inline; }
}
@media #{$medium-only} {
background:pink;
span.medium{ display:inline; }
}
@media #{$large-up} {
background:green;
span.large{ display:inline; }
}
@media #{$xlarge-up} {
color:red;
span.xlarge{ display:inline }
}
}
SASS: EXTENDING / INHERITING
.buttonanimation{
-o-transition:color .3s linear, background .4s linear;
-ms-transition:color .3s linear, background .4s linear;
-moz-transition:color .3s linear, background .4s linear;
-webkit-transition:color .3s linear, background .4s linear
transition:color .3s linear, background .4s linear;
}
button{
color:#fff;
background:#198fe6;
border:1px solid #fff;
padding:5px 20px;
text-transform:uppercase;
font-size:15px;
@extend .buttonanimation;
&:hover,
&:focus,
&:active{
background:#fff;
border:1px solid #198fe6;
color:#198fe6;
}
}
SASS: CONTROL DIRECTIVES, LOGIC & EXPRESSIONS (0)
@if
@for
@each
@while
SASS: CONTROL DIRECTIVES, LOGIC & EXPRESSIONS (1)
@each $type, $color in
(info, $info-color),
(success,$success-color),
(error, $error-color),
(warning, $warning-color) {
.box-#{$type} {
@extend .boxbasics;
// COULD BE AVOIDED: MORE CODE GENERATION
$bordercolor: darken($color, 10%);
@if($type == 'info') {
$bgcolor: $color;
}
@else{
$bgcolor: lighten($color, 30%);
}
color: $bordercolor;
@include background($imgpath: "../images/icons/#{$type}.png
@include border($size:2px, $color: $bordercolor, $bottom:tr
}
}
SASS: MIXINS & ARGUMENTS
@mixin border($size: 1px, $color: transparant,
$left: false, $bottom: false, $right:false, $top: false){
@if ($left) { border-left: $size solid $color; }
@if ($right) { border-right: $size solid $color; }
@if ($top) { border-top: $size solid $color; }
@if ($bottom) { border-bottom: $size solid $color; }
}
@mixin box-sizing($type:border-box) {
-webkit-box-sizing: $type; // Android < 2.3, iOS < 4
-moz-box-sizing: $type; // Firefox < 29
box-sizing: $type; // Chrome, IE 8+, Opera, Safari
}
FRAMEWORKS USING SASS
Zurb Foundation
Bootstrap
Bourbon
Gumby
.. your own?
II) INTRODUCING LESS
What is LESS?
LESS on the client
LESS on the server
importing
variables
functions
operations
mixins
nested rules
WHAT IS LESS?
Dynamic style sheet language
Compiles to CSS (client or server)
Introduces programming features to css (calculations)
Looks and feels like CSS (all CSS is valid LESS)
USING LESS ON THE CLIENT
<html>
<head>
<link rel="stylesheet/less" type="text/css" href="css/my.less"
<script src="js/less.js" type="text/javascript"></script>
</head>
</html>
USING LESS ON THE SERVER
Ability to cache it
Reducing the processing time on the client
Scale out the HTML
Server support for LESS
Node.js
ASP.NET
Rails
JSP
...
NODE.JS
$ npm install less
$ lessc styles.less
$ lessc styles.less > styles.css
var less = require('less');
less.render(lessContents,
function (e, css) {
console.log(css);
});
LESS BASICS
LESS is meant to feel like CSS but better
Ability to cache it
All CSS is valid... really
Renaming your .css to .less works
LESS adds to CSS
Mix of LESS and CSS is no problem, only LESS gets compiled to
CSS
LESS BASICS
@baseFontSize: 14px;
/* Comments */
// Comments too
#main
{
h1
{
font-size: @baseFontSize;
}
}
IMPORTING
@import works
Embeds other .less files in a file
Allows for simple modularization
While maintaining merging of CSS
If import is .css, it preserves the @import statement
If import is .less, it merges it into file
init.less
@import "init";
VARIABLES
@myColor: #ffeedd;
// They are Constants, this doesn’t work
@myColor: @myColor + 5%;
@a: Black; // Color
@b: 4px; // Units
@c: 1.0em; // Units
@d: Helvectica, sans serif; // Strings
@e: 1px #000 Solid 0 0; // Complex Type
OPERATIONS
font-size: 4px + 4; // 8px
font-size: 20px * .8; // 16px;
color: #FFF / 4; // #404040;
width: (100% / 2) + 25%; // 75%
COLOR FUNCTIONS
color: lighten(@color, 10%);
color: darken(@color, 10%);
color: saturate(@color, 10%);
color: desaturate (@color, 10%);
color: fadein(@color, 10%);
color: fadeout(@color, 10%);
color: fade(@color, 50%); // change transparency
color: spin(@color, 10%);
color: mix(@color, #246);
MORE FUNCTIONS
@hue: hue(@color);
@sat: saturation(@color);
@light: lightness(@color);
@alpha: alpha(@color);
@color: hsl(20%, 30%, 40%);
// Math
@rnd: round(3.14);
@top: ceil(3.14);
@bot: floor(3.14);
@per: percentage(.14);
MIXINS
Repeatable sections
Feel like functions
But insert more than one name/value pair
Can accept parameters, defaults and overloads
MIXINS
.rounded-corners-all(@size)
{
border-radius: @size;
-webkit-border-radius: @size;
-moz-border-radius: @size;
}
#form
{
.rounded-corners-all(5px);
}
MIXINS - DEFAULTS
// Default Values
.rounded-corners-all(@size: 5px)
{
border-radius: @size;
-webkit-border-radius: @size;
-moz-border-radius: @size;
}
#form
{
.rounded-corners-all;
}
MIXINS - OVERLOADS
// Using overloads
.color(@color)
{
color: @color;
}
.color(@color, @factor)
{
color: lighten(@color, @factor);
}
#form
{
.color(#888, 20%); // Uses 2nd overload
}
MIXINS - GUARDS
// Using guards
.color(@color) when (alpha(@color) >= 50%)
{
color: Black;
}
.color(@color) when (alpha(@color) < 50%)
{
color: transparent;
}
#form
{
.color(@mainColor); // Uses 1st overload
}
NESTED RULES
Allows you to structure rules in a logical way
Hierarchies imply the cascading/specificity
LESS then deconstructs it into CSS for you
NESTED RULES
// LESS Nested Rules
nav {
font-size: 14px;
font-weight: bold;
float: right;
ul {
// Makes “nav ul {...}”
list-style-type: none;
li {
// Makes “nav ul li {...}”
float: left;
margin: 2px;
}
}
}
NESTED RULES
// Use Combinator (&) to mix with parent:
a
{
text-decoration: none;
&:hover
{
text-decoration: underline;
}
}
// Results in
a { text-decoration: none; }
a:hover { text-decoration: underline; }
DOCUMENTATION ETC.
Sass Lang website
Sass Compatibility
Zurb Foundation
Official LESS website
Sass vs LESS
BEDANKT!
Frédéric Ghijselinck & Sam Vloeberghs
Competence Center Front-end & UX

More Related Content

Viewers also liked

Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Bart Read
 
Sencha Cmd Quick Start
Sencha Cmd Quick StartSencha Cmd Quick Start
Sencha Cmd Quick Start
Grgur Grisogono
 
Sencha Space review
Sencha Space reviewSencha Space review
Sencha Space review
Grgur Grisogono
 
Has Anyone Asked a Customer?
Has Anyone Asked a Customer?Has Anyone Asked a Customer?
Has Anyone Asked a Customer?
Grgur Grisogono
 
Give Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance BoostGive Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance Boost
Grgur Grisogono
 
What's Coming Next in Sencha Frameworks
What's Coming Next in Sencha FrameworksWhat's Coming Next in Sencha Frameworks
What's Coming Next in Sencha Frameworks
Grgur Grisogono
 
Building Cordova plugins for iOS
Building Cordova plugins for iOSBuilding Cordova plugins for iOS
Building Cordova plugins for iOS
Grgur Grisogono
 
Practices and obstacles in agile development
Practices and obstacles in agile developmentPractices and obstacles in agile development
Practices and obstacles in agile development
Grgur Grisogono
 
High Performance Web Sites - 2008
High Performance Web Sites - 2008High Performance Web Sites - 2008
High Performance Web Sites - 2008
Nate Koechley
 
ModUX keynote
ModUX keynoteModUX keynote
ModUX keynote
Grgur Grisogono
 
Securing Client Side Data
 Securing Client Side Data Securing Client Side Data
Securing Client Side Data
Grgur Grisogono
 
Exploring the Possibilities of Sencha and WebRTC
Exploring the Possibilities of Sencha and WebRTCExploring the Possibilities of Sencha and WebRTC
Exploring the Possibilities of Sencha and WebRTC
Grgur Grisogono
 
AngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UXAngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UX
JWORKS powered by Ordina
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
JWORKS powered by Ordina
 
Google’s PRPL Web development pattern
Google’s PRPL Web development patternGoogle’s PRPL Web development pattern
Google’s PRPL Web development pattern
Jeongkyu Shin
 
Webpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ StepsWebpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ Steps
Grgur Grisogono
 
PRPL Pattern with Webpack and React
PRPL Pattern with Webpack and ReactPRPL Pattern with Webpack and React
PRPL Pattern with Webpack and React
Grgur Grisogono
 
Frustration-Free Packaging of Ext JS 5 Applications
Frustration-Free Packaging of Ext JS 5 ApplicationsFrustration-Free Packaging of Ext JS 5 Applications
Frustration-Free Packaging of Ext JS 5 Applications
Grgur Grisogono
 
Back to the Future with ES.next
Back to the Future with ES.nextBack to the Future with ES.next
Back to the Future with ES.next
Grgur Grisogono
 
Measuring Web Performance
Measuring Web Performance Measuring Web Performance
Measuring Web Performance
Dave Olsen
 

Viewers also liked (20)

Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
 
Sencha Cmd Quick Start
Sencha Cmd Quick StartSencha Cmd Quick Start
Sencha Cmd Quick Start
 
Sencha Space review
Sencha Space reviewSencha Space review
Sencha Space review
 
Has Anyone Asked a Customer?
Has Anyone Asked a Customer?Has Anyone Asked a Customer?
Has Anyone Asked a Customer?
 
Give Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance BoostGive Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance Boost
 
What's Coming Next in Sencha Frameworks
What's Coming Next in Sencha FrameworksWhat's Coming Next in Sencha Frameworks
What's Coming Next in Sencha Frameworks
 
Building Cordova plugins for iOS
Building Cordova plugins for iOSBuilding Cordova plugins for iOS
Building Cordova plugins for iOS
 
Practices and obstacles in agile development
Practices and obstacles in agile developmentPractices and obstacles in agile development
Practices and obstacles in agile development
 
High Performance Web Sites - 2008
High Performance Web Sites - 2008High Performance Web Sites - 2008
High Performance Web Sites - 2008
 
ModUX keynote
ModUX keynoteModUX keynote
ModUX keynote
 
Securing Client Side Data
 Securing Client Side Data Securing Client Side Data
Securing Client Side Data
 
Exploring the Possibilities of Sencha and WebRTC
Exploring the Possibilities of Sencha and WebRTCExploring the Possibilities of Sencha and WebRTC
Exploring the Possibilities of Sencha and WebRTC
 
AngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UXAngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UX
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
 
Google’s PRPL Web development pattern
Google’s PRPL Web development patternGoogle’s PRPL Web development pattern
Google’s PRPL Web development pattern
 
Webpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ StepsWebpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ Steps
 
PRPL Pattern with Webpack and React
PRPL Pattern with Webpack and ReactPRPL Pattern with Webpack and React
PRPL Pattern with Webpack and React
 
Frustration-Free Packaging of Ext JS 5 Applications
Frustration-Free Packaging of Ext JS 5 ApplicationsFrustration-Free Packaging of Ext JS 5 Applications
Frustration-Free Packaging of Ext JS 5 Applications
 
Back to the Future with ES.next
Back to the Future with ES.nextBack to the Future with ES.next
Back to the Future with ES.next
 
Measuring Web Performance
Measuring Web Performance Measuring Web Performance
Measuring Web Performance
 

Similar to A better CSS: Sass and Less - CC FE & UX

Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
Dinu Suman
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
Idan Gazit
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
James Pearce
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Kaelig Deloumeau-Prigent
 
Finding your way with Sass+Compass
Finding your way with Sass+CompassFinding your way with Sass+Compass
Finding your way with Sass+Compass
drywallbmb
 
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
Sanjoy Kr. Paul
 
Workshop 6: Designer tools
Workshop 6: Designer toolsWorkshop 6: Designer tools
Workshop 6: Designer tools
Visual Engineering
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
David Engel
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
Rob Friesel
 
@Agawish creating a stunning ui with oracle adf faces, using sass
@Agawish   creating a stunning ui with oracle adf faces, using sass@Agawish   creating a stunning ui with oracle adf faces, using sass
@Agawish creating a stunning ui with oracle adf faces, using sass
Amr Gawish
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
Andreas Dantz
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
Zeeshan Ahmed
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
Lucien Lee
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
bentleyhoke
 
Sakai Meet MORPHEUS: Slides
Sakai Meet MORPHEUS: SlidesSakai Meet MORPHEUS: Slides
Sakai Meet MORPHEUS: Slides
alienresident
 
Finding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with CompassFinding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with Compass
Claudina Sarahe
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
Chris Schneider
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
Mario Noble
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
emrox
 
LESS is More
LESS is MoreLESS is More
LESS is More
jsmith92
 

Similar to A better CSS: Sass and Less - CC FE & UX (20)

Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
 
Finding your way with Sass+Compass
Finding your way with Sass+CompassFinding your way with Sass+Compass
Finding your way with Sass+Compass
 
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
 
Workshop 6: Designer tools
Workshop 6: Designer toolsWorkshop 6: Designer tools
Workshop 6: Designer tools
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
@Agawish creating a stunning ui with oracle adf faces, using sass
@Agawish   creating a stunning ui with oracle adf faces, using sass@Agawish   creating a stunning ui with oracle adf faces, using sass
@Agawish creating a stunning ui with oracle adf faces, using sass
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
 
Sakai Meet MORPHEUS: Slides
Sakai Meet MORPHEUS: SlidesSakai Meet MORPHEUS: Slides
Sakai Meet MORPHEUS: Slides
 
Finding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with CompassFinding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with Compass
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
LESS is More
LESS is MoreLESS is More
LESS is More
 

More from JWORKS powered by Ordina

Introduction to Webpack - Ordina JWorks - CC JS & Web
Introduction to Webpack - Ordina JWorks - CC JS & WebIntroduction to Webpack - Ordina JWorks - CC JS & Web
Introduction to Webpack - Ordina JWorks - CC JS & Web
JWORKS powered by Ordina
 
Lagom in Practice
Lagom in PracticeLagom in Practice
Lagom in Practice
JWORKS powered by Ordina
 
Netflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLandNetflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLand
JWORKS powered by Ordina
 
Cc internet of things @ Thomas More
Cc internet of things @ Thomas MoreCc internet of things @ Thomas More
Cc internet of things @ Thomas More
JWORKS powered by Ordina
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
JWORKS powered by Ordina
 
An introduction to Cloud Foundry
An introduction to Cloud FoundryAn introduction to Cloud Foundry
An introduction to Cloud Foundry
JWORKS powered by Ordina
 
Cc internet of things LoRa and IoT - Innovation Enablers
Cc internet of things   LoRa and IoT - Innovation Enablers Cc internet of things   LoRa and IoT - Innovation Enablers
Cc internet of things LoRa and IoT - Innovation Enablers
JWORKS powered by Ordina
 
Mongodb @ vrt
Mongodb @ vrtMongodb @ vrt
Mongo db intro.pptx
Mongo db intro.pptxMongo db intro.pptx
Mongo db intro.pptx
JWORKS powered by Ordina
 
Big data document and graph d bs - couch-db and orientdb
Big data  document and graph d bs - couch-db and orientdbBig data  document and graph d bs - couch-db and orientdb
Big data document and graph d bs - couch-db and orientdb
JWORKS powered by Ordina
 
Big data key-value and column stores redis - cassandra
Big data  key-value and column stores redis - cassandraBig data  key-value and column stores redis - cassandra
Big data key-value and column stores redis - cassandra
JWORKS powered by Ordina
 
Hadoop bootcamp getting started
Hadoop bootcamp getting startedHadoop bootcamp getting started
Hadoop bootcamp getting started
JWORKS powered by Ordina
 
Big data elasticsearch practical
Big data  elasticsearch practicalBig data  elasticsearch practical
Big data elasticsearch practical
JWORKS powered by Ordina
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandra
JWORKS powered by Ordina
 
Android wear - CC Mobile
Android wear - CC MobileAndroid wear - CC Mobile
Android wear - CC Mobile
JWORKS powered by Ordina
 
Clean Code - A&BP CC
Clean Code - A&BP CCClean Code - A&BP CC
Clean Code - A&BP CC
JWORKS powered by Ordina
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
JWORKS powered by Ordina
 
Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
JWORKS powered by Ordina
 
Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014
JWORKS powered by Ordina
 
Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
JWORKS powered by Ordina
 

More from JWORKS powered by Ordina (20)

Introduction to Webpack - Ordina JWorks - CC JS & Web
Introduction to Webpack - Ordina JWorks - CC JS & WebIntroduction to Webpack - Ordina JWorks - CC JS & Web
Introduction to Webpack - Ordina JWorks - CC JS & Web
 
Lagom in Practice
Lagom in PracticeLagom in Practice
Lagom in Practice
 
Netflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLandNetflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLand
 
Cc internet of things @ Thomas More
Cc internet of things @ Thomas MoreCc internet of things @ Thomas More
Cc internet of things @ Thomas More
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
An introduction to Cloud Foundry
An introduction to Cloud FoundryAn introduction to Cloud Foundry
An introduction to Cloud Foundry
 
Cc internet of things LoRa and IoT - Innovation Enablers
Cc internet of things   LoRa and IoT - Innovation Enablers Cc internet of things   LoRa and IoT - Innovation Enablers
Cc internet of things LoRa and IoT - Innovation Enablers
 
Mongodb @ vrt
Mongodb @ vrtMongodb @ vrt
Mongodb @ vrt
 
Mongo db intro.pptx
Mongo db intro.pptxMongo db intro.pptx
Mongo db intro.pptx
 
Big data document and graph d bs - couch-db and orientdb
Big data  document and graph d bs - couch-db and orientdbBig data  document and graph d bs - couch-db and orientdb
Big data document and graph d bs - couch-db and orientdb
 
Big data key-value and column stores redis - cassandra
Big data  key-value and column stores redis - cassandraBig data  key-value and column stores redis - cassandra
Big data key-value and column stores redis - cassandra
 
Hadoop bootcamp getting started
Hadoop bootcamp getting startedHadoop bootcamp getting started
Hadoop bootcamp getting started
 
Big data elasticsearch practical
Big data  elasticsearch practicalBig data  elasticsearch practical
Big data elasticsearch practical
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandra
 
Android wear - CC Mobile
Android wear - CC MobileAndroid wear - CC Mobile
Android wear - CC Mobile
 
Clean Code - A&BP CC
Clean Code - A&BP CCClean Code - A&BP CC
Clean Code - A&BP CC
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
 
Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014
 
Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
 

Recently uploaded

制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
cuobya
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
SEO Article Boost
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
Trending Blogers
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
Laura Szabó
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
Danica Gill
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
hackersuli
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
wolfsoftcompanyco
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 

Recently uploaded (20)

制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 

A better CSS: Sass and Less - CC FE & UX

  • 1. A BETTER CSS : SASS & LESS By Frédéric Ghijselinck & Sam Vloeberghs Competence Center Front-end & UX
  • 2. A BETTER CSS : SASS & LESS I. What's wrong with CSS? II. Introducing Sass III. Introducing LESS IV. Hands-on
  • 3. I) WHAT'S WRONG WITH CSS Browser incompatibilities No functions / logic No variables Uncustomizable frameworks DRY ..
  • 4. SASS;CSSWITHSUPERPOWERS Sass Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.
  • 5. II) INTRODUCING SASS CSS Compatible Feature rich Mature Large community Framework adaption Examples explained using a Sass variant, Scss
  • 7. CSS EXTENSIONS Variables Nested rules & properties Referencing parent selectors Functions Interpolation Variable defaults ...
  • 8. SASS: VARIABLES $success-color: #43AC6A; $warning-color: #f08a24; $linkcolor: $warning-color; $otherlinkcolor: $success-color;
  • 9. SASS: NESTED RULES & PROPERTIES h1{ margin-bottom:15px; font: { size: 1.4em; weight: bold; } } h2{ margin-bottom:15px; font: { size: 1.2em; weight: bold; } }
  • 10. SASS: REFERENCING PARENT SELECTORS a{ color:$linkcolor; text-decoration:none; &:hover{ border-bottom: 1px solid $linkcolor; } }
  • 11. SASS: FUNCTIONS $p_color: $primary-color; p{ content: 'This is a paragraph'; color: $p_color; padding:10px; border: 2px solid $p_color; &.darker{ $d_color: darken($color: $p_color, $amount: 10%); color: $d_color; border-color: $d_color; } &.lighter{ $l_color: lighten($amount: 30%, $color: $p_color); color: $l_color; border-color: $l_color; } }
  • 12. SASS: INTERPOLATION $name: fancy; $attr: font; p.#{$name} { #{$attr}-color: blue; }
  • 13. SASS: VARIABLE DEFAULTS $content: "First content"; $content: "Second content?" !default; $bis_content: "First bis content" !default; p { margin-bottom:10px; &.primary:before { content: $content; } &.secundary:before { content: $bis_content; } }
  • 14. @-RULES & DIRECTIVES Importing & partials Media queries Extending / inheriting Mixins & arguments Control directives, logic & expressions
  • 15. SASS: IMPORTING & PARTIALS @import "reset"; @import "settings"; @import "utils"; @import "styles"; @import "foo.css"; @import "foo" screen; @import "http://foo.com/bar"; @import url(foo);
  • 16. SASS: MEDIA QUERIES .vierkant{ height:150px; text-align:center; color:#fff; font-weight:bold; span{ display:none; } @media #{$small-only} { background: blue; span.small{ display:inline; } } @media #{$medium-only} { background:pink; span.medium{ display:inline; } } @media #{$large-up} { background:green; span.large{ display:inline; } } @media #{$xlarge-up} { color:red; span.xlarge{ display:inline } } }
  • 17. SASS: EXTENDING / INHERITING .buttonanimation{ -o-transition:color .3s linear, background .4s linear; -ms-transition:color .3s linear, background .4s linear; -moz-transition:color .3s linear, background .4s linear; -webkit-transition:color .3s linear, background .4s linear transition:color .3s linear, background .4s linear; } button{ color:#fff; background:#198fe6; border:1px solid #fff; padding:5px 20px; text-transform:uppercase; font-size:15px; @extend .buttonanimation; &:hover, &:focus, &:active{ background:#fff; border:1px solid #198fe6; color:#198fe6; } }
  • 18. SASS: CONTROL DIRECTIVES, LOGIC & EXPRESSIONS (0) @if @for @each @while
  • 19. SASS: CONTROL DIRECTIVES, LOGIC & EXPRESSIONS (1) @each $type, $color in (info, $info-color), (success,$success-color), (error, $error-color), (warning, $warning-color) { .box-#{$type} { @extend .boxbasics; // COULD BE AVOIDED: MORE CODE GENERATION $bordercolor: darken($color, 10%); @if($type == 'info') { $bgcolor: $color; } @else{ $bgcolor: lighten($color, 30%); } color: $bordercolor; @include background($imgpath: "../images/icons/#{$type}.png @include border($size:2px, $color: $bordercolor, $bottom:tr } }
  • 20. SASS: MIXINS & ARGUMENTS @mixin border($size: 1px, $color: transparant, $left: false, $bottom: false, $right:false, $top: false){ @if ($left) { border-left: $size solid $color; } @if ($right) { border-right: $size solid $color; } @if ($top) { border-top: $size solid $color; } @if ($bottom) { border-bottom: $size solid $color; } } @mixin box-sizing($type:border-box) { -webkit-box-sizing: $type; // Android < 2.3, iOS < 4 -moz-box-sizing: $type; // Firefox < 29 box-sizing: $type; // Chrome, IE 8+, Opera, Safari }
  • 21. FRAMEWORKS USING SASS Zurb Foundation Bootstrap Bourbon Gumby .. your own?
  • 22. II) INTRODUCING LESS What is LESS? LESS on the client LESS on the server importing variables functions operations mixins nested rules
  • 23. WHAT IS LESS? Dynamic style sheet language Compiles to CSS (client or server) Introduces programming features to css (calculations) Looks and feels like CSS (all CSS is valid LESS)
  • 24. USING LESS ON THE CLIENT <html> <head> <link rel="stylesheet/less" type="text/css" href="css/my.less" <script src="js/less.js" type="text/javascript"></script> </head> </html>
  • 25. USING LESS ON THE SERVER Ability to cache it Reducing the processing time on the client Scale out the HTML Server support for LESS Node.js ASP.NET Rails JSP ...
  • 26. NODE.JS $ npm install less $ lessc styles.less $ lessc styles.less > styles.css var less = require('less'); less.render(lessContents, function (e, css) { console.log(css); });
  • 27. LESS BASICS LESS is meant to feel like CSS but better Ability to cache it All CSS is valid... really Renaming your .css to .less works LESS adds to CSS Mix of LESS and CSS is no problem, only LESS gets compiled to CSS
  • 28. LESS BASICS @baseFontSize: 14px; /* Comments */ // Comments too #main { h1 { font-size: @baseFontSize; } }
  • 29. IMPORTING @import works Embeds other .less files in a file Allows for simple modularization While maintaining merging of CSS If import is .css, it preserves the @import statement If import is .less, it merges it into file init.less @import "init";
  • 30. VARIABLES @myColor: #ffeedd; // They are Constants, this doesn’t work @myColor: @myColor + 5%; @a: Black; // Color @b: 4px; // Units @c: 1.0em; // Units @d: Helvectica, sans serif; // Strings @e: 1px #000 Solid 0 0; // Complex Type
  • 31. OPERATIONS font-size: 4px + 4; // 8px font-size: 20px * .8; // 16px; color: #FFF / 4; // #404040; width: (100% / 2) + 25%; // 75%
  • 32. COLOR FUNCTIONS color: lighten(@color, 10%); color: darken(@color, 10%); color: saturate(@color, 10%); color: desaturate (@color, 10%); color: fadein(@color, 10%); color: fadeout(@color, 10%); color: fade(@color, 50%); // change transparency color: spin(@color, 10%); color: mix(@color, #246);
  • 33. MORE FUNCTIONS @hue: hue(@color); @sat: saturation(@color); @light: lightness(@color); @alpha: alpha(@color); @color: hsl(20%, 30%, 40%); // Math @rnd: round(3.14); @top: ceil(3.14); @bot: floor(3.14); @per: percentage(.14);
  • 34. MIXINS Repeatable sections Feel like functions But insert more than one name/value pair Can accept parameters, defaults and overloads
  • 36. MIXINS - DEFAULTS // Default Values .rounded-corners-all(@size: 5px) { border-radius: @size; -webkit-border-radius: @size; -moz-border-radius: @size; } #form { .rounded-corners-all; }
  • 37. MIXINS - OVERLOADS // Using overloads .color(@color) { color: @color; } .color(@color, @factor) { color: lighten(@color, @factor); } #form { .color(#888, 20%); // Uses 2nd overload }
  • 38. MIXINS - GUARDS // Using guards .color(@color) when (alpha(@color) >= 50%) { color: Black; } .color(@color) when (alpha(@color) < 50%) { color: transparent; } #form { .color(@mainColor); // Uses 1st overload }
  • 39. NESTED RULES Allows you to structure rules in a logical way Hierarchies imply the cascading/specificity LESS then deconstructs it into CSS for you
  • 40. NESTED RULES // LESS Nested Rules nav { font-size: 14px; font-weight: bold; float: right; ul { // Makes “nav ul {...}” list-style-type: none; li { // Makes “nav ul li {...}” float: left; margin: 2px; } } }
  • 41. NESTED RULES // Use Combinator (&) to mix with parent: a { text-decoration: none; &:hover { text-decoration: underline; } } // Results in a { text-decoration: none; } a:hover { text-decoration: underline; }
  • 42. DOCUMENTATION ETC. Sass Lang website Sass Compatibility Zurb Foundation Official LESS website Sass vs LESS
  • 43. BEDANKT! Frédéric Ghijselinck & Sam Vloeberghs Competence Center Front-end & UX