SlideShare a Scribd company logo
LESS, The CSS
  Preprocessor

        Andrea Tarr
  MetaScale /Sears Holdings
Joomla Day New England 2013
What is LESS
Using LESS
LESS in Joomla




April 13, 2013   JDNE: LESS, The CSS Preprocessor   2
Dynamic CSS
Easy Customization
Reuse
Power of Variables




April 13, 2013   JDNE: LESS, The CSS Preprocessor   3
Dynamic CSS
Super set of CSS



.LESS
April 13, 2013   JDNE: LESS, The CSS Preprocessor   4
Preprocessing
Client Side
http://lesscss.org




April 13, 2013   JDNE: LESS, The CSS Preprocessor   5
<link rel="stylesheet/
less" type="text/css"
href="styles.less" />
<script src="less.js"
type="text/javascript"></
script>


April 13, 2013   JDNE: LESS, The CSS Preprocessor   6
Preprocessing
Server Side
http://leafo.net/lessphp
http://nodejs.org




April 13, 2013   JDNE: LESS, The CSS Preprocessor   7
1.  Install node.js
http://nodejs.org
2. Install LESS
sudo npm install -g less
3. Process CSS files
lessc ../less/template.less
> template.css

April 13, 2013   JDNE: LESS, The CSS Preprocessor   8
Why LESS not SASS?
Faster
JavaScript
CSS Syntax




April 13, 2013   JDNE: LESS, The CSS Preprocessor   9
@
Variables
Define once,
use often




April 13, 2013   JDNE: LESS, The CSS Preprocessor   10
@text-color: #2c2c2c;
p{
  color: @text-color;
}




April 13, 2013   JDNE: LESS, The CSS Preprocessor   11
h2 {
  color: @text-color;
  border: 1px solid
@text-color;
}



April 13, 2013   JDNE: LESS, The CSS Preprocessor   12
Mixins
Shorthand classes




April 13, 2013
                                    .
                 JDNE: LESS, The CSS Preprocessor   13
.rounded {
  -webkit-border-radius:
5px;
  -moz-border-radius: 5px;
  -ms-border-radius: 5px;
  -o-border-radius: 5px;
  border-radius: 5px;
}

April 13, 2013   JDNE: LESS, The CSS Preprocessor   14
.sideboxa {
  .rounded;
}
.sideboxb {
  padding: 5px;
  .rounded;
}

April 13, 2013   JDNE: LESS, The CSS Preprocessor   15
()
Mixins
Parameters




April 13, 2013   JDNE: LESS, The CSS Preprocessor   16
.rounded (@radius: 5px) {
  -webkit-border-radius:
@radius;
  -moz-border-radius: @radius;
  -ms-border-radius: @radius;
  -o-border-radius: @radius;
  border-radius: @radius;
}

April 13, 2013   JDNE: LESS, The CSS Preprocessor   17
.sideboxa {
  .rounded;
}
.sideboxb {
  padding: 5px;
  .rounded(3px);
}

April 13, 2013   JDNE: LESS, The CSS Preprocessor   18
Operations                                          +
Math!
                                                    -
                                                    *
                                                    /
                                                    ()
April 13, 2013   JDNE: LESS, The CSS Preprocessor        19
@base-margin: 15px;
@base: 5%;
@filler: (@base * 2);
.box1 {
  margin-bottom: (@base-
margin + 20px);
  height: (100% / 2 + @filler);
}

April 13, 2013   JDNE: LESS, The CSS Preprocessor   20
@link-color: #3f43ca;
a{
  color: @link-color;
}
a:hover {
  color: (@link-color +
#222);
}
April 13, 2013   JDNE: LESS, The CSS Preprocessor   21
()
Functions
Built-in




April 13, 2013   JDNE: LESS, The CSS Preprocessor   22
@link-color: #3f43ca;
a{
  color: @link-color;
}
a:hover {
  color: lighten(@link-
color, 10%;
}
April 13, 2013   JDNE: LESS, The CSS Preprocessor   23
lighten(@color, 10%);
darken(@color, 10%);

saturate(@color, 10%);
desaturate(@color, 10%);

fadein(@color, 10%);
spin(@color, 10);
April 13, 2013   JDNE: LESS, The CSS Preprocessor   24
/*
Comments
CSS Style
Included


                                      */
April 13, 2013   JDNE: LESS, The CSS Preprocessor   25
/* Header styles
for blog pages */




April 13, 2013   JDNE: LESS, The CSS Preprocessor   26
//
Comments
Single line
Not included




April 13, 2013   JDNE: LESS, The CSS Preprocessor   27
// Override from template




April 13, 2013   JDNE: LESS, The CSS Preprocessor   28
@
@import
CSS files
LESS files




April 13, 2013   JDNE: LESS, The CSS Preprocessor   29
@import          "variables.less";
@import          "mixins.less";
@import          "layout.less";
@import          "grid.less";

Compiles to single file


April 13, 2013   JDNE: LESS, The CSS Preprocessor   30
Nesting
                                                {
                                                    .{}
                                                    &{ }
                                                }
April 13, 2013   JDNE: LESS, The CSS Preprocessor          31
#header { color: #2c2c2c; }
#header .navigation {
 font-size: 12px; }
#header .logo {
 width: 300px; }
#header .logo:hover {
 text-decoration: underline; }


April 13, 2013   JDNE: LESS, The CSS Preprocessor   32
#header      {           color: #2c2c2c;
 .navigation {           font-size: 12px; }
 .logo       {           width: 300px;
   &:hover   {           text-decoration:
                           underline; }
    }
}


April 13, 2013   JDNE: LESS, The CSS Preprocessor   33
Debug Issues
Firebug gives CSS line
Search LESS files for
multiple selectors
Doesn't work when
nested


April 13, 2013   JDNE: LESS, The CSS Preprocessor   34
LESS in Joomla




April 13, 2013   JDNE: LESS, The CSS Preprocessor   35
You don't
need LESS
for Joomla
templates
April 13, 2013   JDNE: LESS, The CSS Preprocessor   36
Joomla Bootstrap files
are already compiled
Some Bootstrap
template vendors don't
distribute LESS files



April 13, 2013   JDNE: LESS, The CSS Preprocessor   37
You don't need LESS in
Joomla

... but it's very helpful!




April 13, 2013   JDNE: LESS, The CSS Preprocessor   38
Joomla JUI files
media
 jui
   css
   fonts
   img
   js
   less
April 13, 2013   JDNE: LESS, The CSS Preprocessor   39
media/jui/less
accordion.less
alerts.less
bootstrap-extended.less
bootstrap-rtl.less
bootstrap.less
breadcrumbs.less
button-groups.less
buttons.less
April 13, 2013   JDNE: LESS, The CSS Preprocessor   40
carousel.less
close.less
code.less
component-
animations.less
dropdowns.less
forms.less
grid.less
hero-unit.less
April 13, 2013   JDNE: LESS, The CSS Preprocessor   41
icomoon.less
labels-badges.less
layouts.less
mixins.less
modals.less
navbar.less
navs.less
pager.less
April 13, 2013   JDNE: LESS, The CSS Preprocessor   42
pagination.less
popovers.less
progress-bars.less
reset.less
responsive-1200px-
min.less
responsive-767px-
max.less
April 13, 2013   JDNE: LESS, The CSS Preprocessor   43
responsive-768px-979p
x.less
responsive-navbar.less
responsive-utilities.less
responsive.less
scaffolding.less
sprites.less
tables.less
thumbnails.less
April 13, 2013   JDNE: LESS, The CSS Preprocessor   44
tooltip.less
type.less
utilities.less
variables.less
wells.less



April 13, 2013   JDNE: LESS, The CSS Preprocessor   45
JUI Extensions
bootstrap-extended.less




April 13, 2013   JDNE: LESS, The CSS Preprocessor   46
Bootstrap.less
contains @imports of
other less files.

Replace bootstrap.less
with template.less in
your template.

April 13, 2013   JDNE: LESS, The CSS Preprocessor   47
mytemplate
 css
   template.css
 html
 images
 less
   template.less
   variables.less
 index.php
April 13, 2013   JDNE: LESS, The CSS Preprocessor   48
variables.less
Sets up variables for
your template
Copy file from media/jui/
less and change it in your
template


April 13, 2013   JDNE: LESS, The CSS Preprocessor   49
variables.less
@bodyBackground: #ffffff;
@textColor: #2c2c2c;
@linkColor: #08c08d;
@linkColorHover:
darken(@linkColor, 15%);
@sansFontFamily: "Helvetica
Neue", Helvetica, Arial, sans-
serif;
April 13, 2013   JDNE: LESS, The CSS Preprocessor   50
template.less
@import less files from
media/jui/less
@import any less files in
your template
Add styles for your
template using less

April 13, 2013   JDNE: LESS, The CSS Preprocessor   51
Remember,
straight CSS
is valid LESS.
Add in LESS where it is
helpful. Ignore it where
it would be confusing.
April 13, 2013   JDNE: LESS, The CSS Preprocessor   52
template.less
@import "../../../media/jui/
less/reset.less";
@import "variables.less";
@import "../../../media/jui/
less/mixins.less";
@import "../../../media/jui/
less/scaffolding.less";
etc...
April 13, 2013   JDNE: LESS, The CSS Preprocessor   53
template.less (con't)
@import "../../../media/jui/
less/bootstrap-
extended.less";
Has to be after the other
Bootstrap @imports to
override when necessary

April 13, 2013   JDNE: LESS, The CSS Preprocessor   54
template.less (con't)
After the imports, add
your styles
.img_caption .right {
  float: right;
  margin-left: 1em;
}

April 13, 2013   JDNE: LESS, The CSS Preprocessor   55
Compile template.less
lessc ../less/template.less
> template.css
Call the template.css file
in your index.php file as
usual.


April 13, 2013   JDNE: LESS, The CSS Preprocessor   56
Questions?


April 13, 2013   JDNE: LESS, The CSS Preprocessor   57

More Related Content

What's hot (20)

PDF
How to use CSS3 in WordPress
Suzette Franck
 
PDF
Preprocessor presentation
Mario Noble
 
PDF
Sass
Bram Verdyck
 
PDF
Haml And Sass In 15 Minutes
Patrick Crowley
 
PDF
LESS CSS Pre-processor
Kannika Kong
 
PDF
From CSS to Sass in WordPress
James Steinbach
 
PPTX
Css frameworks
Dimitar Belchugov
 
PPTX
From PSD to WordPress Theme: Bringing designs to life
Derek Christensen
 
PPTX
BDUG Responsive Web Theming - 7/23/12
ucbdrupal
 
KEY
HTML CSS & Javascript
David Lindkvist
 
PDF
Modern Front-End Development
mwrather
 
ODP
Compile your Style
Ragnar Kurm
 
PDF
LESS is More
jsmith92
 
PPT
Html & Css presentation
joilrahat
 
PDF
Responsive Websites
Joe Seifi
 
PDF
Intro to Sass for WordPress Developers
Suzette Franck
 
PDF
CSS 開發加速指南-Sass & Compass
Lucien Lee
 
PDF
Drawing the Line with Browser Compatibility
jsmith92
 
PDF
How to use CSS3 in WordPress - Sacramento
Suzette Franck
 
PDF
CSS in React
Joe Seifi
 
How to use CSS3 in WordPress
Suzette Franck
 
Preprocessor presentation
Mario Noble
 
Haml And Sass In 15 Minutes
Patrick Crowley
 
LESS CSS Pre-processor
Kannika Kong
 
From CSS to Sass in WordPress
James Steinbach
 
Css frameworks
Dimitar Belchugov
 
From PSD to WordPress Theme: Bringing designs to life
Derek Christensen
 
BDUG Responsive Web Theming - 7/23/12
ucbdrupal
 
HTML CSS & Javascript
David Lindkvist
 
Modern Front-End Development
mwrather
 
Compile your Style
Ragnar Kurm
 
LESS is More
jsmith92
 
Html & Css presentation
joilrahat
 
Responsive Websites
Joe Seifi
 
Intro to Sass for WordPress Developers
Suzette Franck
 
CSS 開發加速指南-Sass & Compass
Lucien Lee
 
Drawing the Line with Browser Compatibility
jsmith92
 
How to use CSS3 in WordPress - Sacramento
Suzette Franck
 
CSS in React
Joe Seifi
 

Similar to LESS, the CSS Preprocessor (20)

PPT
LESS CSS
Mathi Rajalingam
 
PDF
LESS is More (ChiHTML5 Meetup June 2016)
Sara Laupp
 
PPTX
SASS is more than LESS
Itai Koren
 
PDF
Do more with {less}
Jesper Wøldiche
 
PPTX
Less presentation
Todd Shelton
 
PDF
LESS is MOAR
Randy Oest II
 
PPTX
Doing More With Less
David Engel
 
PPTX
Less css framework
Manisha Bano
 
PPT
CSS előfeldolgozók
Máté Farkas
 
PDF
PechaKucha Less VS Sass
Hoang Huynh
 
PPT
Why less?
Bunlong Van
 
PDF
A better CSS: Sass and Less - CC FE & UX
JWORKS powered by Ordina
 
PPTX
Managing responsive websites with css preprocessors.
The University of Akron
 
PDF
LeSS in action
Pu Shiming
 
PPTX
CSS: A Slippery Slope to the Backend
FITC
 
PDF
Less(CSS Pre Processor) Introduction
rushi7567
 
PDF
LESS(CSS Pre Processor) introduction
rushi7567
 
PDF
Getting Started with Sass & Compass
Rob Davarnia
 
PPTX
Preprocessor CSS: SASS
Geoffroy Baylaender
 
PPTX
Start using less css
Ali MasudianPour
 
LESS is More (ChiHTML5 Meetup June 2016)
Sara Laupp
 
SASS is more than LESS
Itai Koren
 
Do more with {less}
Jesper Wøldiche
 
Less presentation
Todd Shelton
 
LESS is MOAR
Randy Oest II
 
Doing More With Less
David Engel
 
Less css framework
Manisha Bano
 
CSS előfeldolgozók
Máté Farkas
 
PechaKucha Less VS Sass
Hoang Huynh
 
Why less?
Bunlong Van
 
A better CSS: Sass and Less - CC FE & UX
JWORKS powered by Ordina
 
Managing responsive websites with css preprocessors.
The University of Akron
 
LeSS in action
Pu Shiming
 
CSS: A Slippery Slope to the Backend
FITC
 
Less(CSS Pre Processor) Introduction
rushi7567
 
LESS(CSS Pre Processor) introduction
rushi7567
 
Getting Started with Sass & Compass
Rob Davarnia
 
Preprocessor CSS: SASS
Geoffroy Baylaender
 
Start using less css
Ali MasudianPour
 
Ad

More from Andrea Tarr (7)

PDF
The State of Joomla - J and Beyond 2013
Andrea Tarr
 
PDF
Bootstrap & Joomla UI
Andrea Tarr
 
PPTX
Bootstrap for Extension Developers JWC 2012
Andrea Tarr
 
PPTX
Bootstrap Introduction
Andrea Tarr
 
PPTX
PHP for HTML Gurus - J and Beyond 2012
Andrea Tarr
 
PPTX
Where is Joomla going and how do we get there? J and Beyond 2012
Andrea Tarr
 
PPTX
Choosing Great Joomla Extensions
Andrea Tarr
 
The State of Joomla - J and Beyond 2013
Andrea Tarr
 
Bootstrap & Joomla UI
Andrea Tarr
 
Bootstrap for Extension Developers JWC 2012
Andrea Tarr
 
Bootstrap Introduction
Andrea Tarr
 
PHP for HTML Gurus - J and Beyond 2012
Andrea Tarr
 
Where is Joomla going and how do we get there? J and Beyond 2012
Andrea Tarr
 
Choosing Great Joomla Extensions
Andrea Tarr
 
Ad

Recently uploaded (20)

PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
Next level data operations using Power Automate magic
Andries den Haan
 
PDF
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Bridging CAD, IBM TRIRIGA & GIS with FME: The Portland Public Schools Case
Safe Software
 
PDF
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PDF
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Practical Applications of AI in Local Government
OnBoard
 
Next level data operations using Power Automate magic
Andries den Haan
 
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Bridging CAD, IBM TRIRIGA & GIS with FME: The Portland Public Schools Case
Safe Software
 
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 

LESS, the CSS Preprocessor