SlideShare a Scribd company logo
{less}
( C S S P R E P R O C E S S O R )
R U S H I R A J B R A H M B H AT T
What is less?
• Less is a CSS pre-processor, meaning that it extends the CSS language, adding
features that allow variables, mixins, functions and many other techniques that
allow you to make CSS that is more maintainable, themeable and extendable.
• Less can run client side as well as server side.
• Less can be pre-compiled into CSS.
• At first less was written in Ruby ,later it was replaced by JavaScript.
Digging LESS Features
1) VARIABLES
2) MIXINS
a)Parametric Mixins
3) NESTING
a) Nested Rules
b) Conditional Nesting
4) PATTERN MATCHING
5) GUARD EXPRESSIONS (i.e. if statement)
LESS Features Cont..
6) Operators
7) Importing & File Paths
8) Functions
a) Color Functions
b) Math functions
9) NAMESPACES
10)SCOPE
LESS Installation
• Install Node.js in your PC.
– https://nodejs.org/en/
• After installing node open command prompt to install LESS
– npm install -g less
• After installation you can invoke the less compiler from command line by using
“lessc”
– lessc your-file.less
– By this you can see the output of CSS code in your command prompt only.
• To generate .css file in your folder use
– lessc your-file.less your-file.css
– This will generate a CSS file in your folder containing LESS file.
Less Installation Cont..
– Every time you make changes in LESS file you have to run this command to make
changes in CSS too.
– This will generate CSS file in your folder with auto generated pure CSS syntax from
LESS syntax.
• To automatically watch over the LESS file and make changes accordingly in to
CSS file
i. Install less-watch-compiler https://github.com/jonycheung/deadsimple-less-
watch-compiler
ii. In command Prompt
• npm install -g less-watch-compiler
iii. Go into your directory containing less file folder
• less-watch-compiler [LESS-FILE-FOLDER] [CSS-FILE-FOLDER-YOU-WANT-TO-GENERATE]
Less Installation Cont..
• This will watch over the folder in which .less file is there and will generate a
folder containing .css file.
– Example:
• Less-watch-compiler LessFolder CSSFolder
• You can also install less-autocompiler package in any editor you are using.
– Add line of code //out: your-file.css on top of .less file, it will automatically generate
.css file in your folder and will auto update as you update .less file.
Less Installation Cont..
• Client-side is the easiest way to get started and good for developing with Less,
but in production, when performance and reliability is important, it is good to
pre-compile using node.js or one of the many third party tools available.
• To start off, link your .less stylesheets with the rel attribute set to "stylesheet/less"
– <link rel="stylesheet/less" type="text/css" href="styles.less" />
• Next, download less.js and include it in a <script></script> tag in the <head>
element of your page:
– <script src="less.js" type="text/javascript"></script>
NOTE :Using less.js in the browser is great for development, but it's not recommended
for production
Variables
Less Syntax CSS Syntax
Mixins
Less Syntax CSS Syntax
Parametric Mixins
Less Syntax CSS Syntax
Nested Rules
Less Syntax CSS Syntax
Conditional Nesting
Less Syntax CSS Syntax
Pattern Matching
Less Syntax CSS Syntax
When there are two mixins with same name and different parameter sets, Less will match
the parameter pattern and apply the mixin that matches.
Guard Expressions(i.e. if)
LESS Syntax CSS Syntax
.myblock (@size) when (@size < 10){
font-size: @size;
color: red;
}
.myblock (@size) when (@size > 20) and (@size < 30){
font-size: @size;
color: green;
}
.myblock (@size) when (@size = 50),(@size=60){
font-size: @size;
color: blue;
}
.block1{
.myblock(5);
}
.block2 {
.myblock(15);
}
.block3 {
.myblock(50);
}
.block1 {
font-size: 5;
color: red;
}
.block2 {
font-size: 25;
color: green;
}
.block3 {
font-size: 50;
color: blue;
}
Operators
Less Syntax CSS Syntax
Importing
• If your less file is growing, you can make different less files of different sections
and importing those less file into your main less file.
• I have two files button.less and banner.less I have imported these files into my
main.less file.
• It is not necessary to write .less extension while importing, LESS is smart enough it
will understand that imported files are less files.
File Paths
Less Syntax CSS Syntax
Color Function
• LESS have color functions to play with colors. You can lighten the base color or
saturate it, even you can mix two or more different colors.
✓ saturate(@color, @amount)
✓ desaturate(@color, @amount)
✓ lighten(@color, @amount)
✓ darken(@color, @amount)
✓ fadein(@color, @amount)
✓ fadeout(@color, @amount)
✓ fade(@color, @amount)
✓ spin(@color, @amount)
✓ mix(@color1, @color2, @weight)
✓ grayscale(@color)
✓ contrast(@color)
Math Function
• Math operations can be used for standard arithmetic or unit conversions. In
addition to simple math, pre-processors also have complex math support such
as ceiling, rounding, getting min or max value in a list etc.
• LESS provides a couple of math functions you can use on number values:
– round(1.67); // returns '2'
– ceil(2.4); // returns '3'
– floor(2.6); // returns '2'
• If you need to turn a value into a percentage, you can do so with the
percentage function:
– percentage(0.5); // returns '50%'
Namespaces
Less Syntax CSS Syntax
Very useful if you want to create your own CSS libraries or distribute CSS.
Less Syntax CSS Syntax
Scope is similar to other programming languages. Variables and mixins first looked
up locally and then if not found it looks for them in the parent.
Scopes
Resource & Reference
• http://lesscss.org/#
• https://htmlmag.com/article/an-introduction-to-css-preprocessors-sass-less-stylus
THANK YOU
R U S H I R A J B R A H M B H AT T
Ad

More Related Content

What's hot (20)

Sass - basic to advance
Sass  - basic to advanceSass  - basic to advance
Sass - basic to advance
Vinita Swamy
 
Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)
Tahmina Khatoon
 
Sass installation
Sass installationSass installation
Sass installation
Vinita Swamy
 
Using Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public CloudUsing Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public Cloud
Jesse Keating
 
AngularJS Version 1.3
AngularJS  Version 1.3AngularJS  Version 1.3
AngularJS Version 1.3
Nir Noy
 
Ch7(publishing my sql data on the web)
Ch7(publishing my sql data on the web)Ch7(publishing my sql data on the web)
Ch7(publishing my sql data on the web)
Chhom Karath
 
Drupal & CSS Preprocessors
Drupal & CSS PreprocessorsDrupal & CSS Preprocessors
Drupal & CSS Preprocessors
kdmarks
 
SASS Preprocessor
SASS PreprocessorSASS Preprocessor
SASS Preprocessor
Webkul Software Pvt. Ltd.
 
Sass: The Future of Stylesheets
Sass: The Future of StylesheetsSass: The Future of Stylesheets
Sass: The Future of Stylesheets
chriseppstein
 
LESS(CSS preprocessor)
LESS(CSS preprocessor)LESS(CSS preprocessor)
LESS(CSS preprocessor)
VIPIN KUMAR
 
Wordpress plugin development tips
Wordpress plugin development tipsWordpress plugin development tips
Wordpress plugin development tips
Mindfire Solutions
 
Less & Sass
Less & SassLess & Sass
Less & Sass
Михаил Петров
 
How to Contribute Code to MySQL?
How to Contribute Code to MySQL?How to Contribute Code to MySQL?
How to Contribute Code to MySQL?
Thava Alagu
 
Rupy2012 ArangoDB Workshop Part2
Rupy2012 ArangoDB Workshop Part2Rupy2012 ArangoDB Workshop Part2
Rupy2012 ArangoDB Workshop Part2
ArangoDB Database
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
OpusVL
 
Be Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - EcosystemBe Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - Ecosystem
Lucas Renan
 
Advanced WordPress Development Environments
Advanced WordPress Development EnvironmentsAdvanced WordPress Development Environments
Advanced WordPress Development Environments
Beau Lebens
 
PostgreSQL - It's kind've a nifty database
PostgreSQL - It's kind've a nifty databasePostgreSQL - It's kind've a nifty database
PostgreSQL - It's kind've a nifty database
Barry Jones
 
Configuring a more secure BOSH
Configuring a more secure BOSHConfiguring a more secure BOSH
Configuring a more secure BOSH
Saman Alvi
 
Cloud Computing Training
Cloud Computing TrainingCloud Computing Training
Cloud Computing Training
Deccansoft
 
Sass - basic to advance
Sass  - basic to advanceSass  - basic to advance
Sass - basic to advance
Vinita Swamy
 
Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)
Tahmina Khatoon
 
Using Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public CloudUsing Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public Cloud
Jesse Keating
 
AngularJS Version 1.3
AngularJS  Version 1.3AngularJS  Version 1.3
AngularJS Version 1.3
Nir Noy
 
Ch7(publishing my sql data on the web)
Ch7(publishing my sql data on the web)Ch7(publishing my sql data on the web)
Ch7(publishing my sql data on the web)
Chhom Karath
 
Drupal & CSS Preprocessors
Drupal & CSS PreprocessorsDrupal & CSS Preprocessors
Drupal & CSS Preprocessors
kdmarks
 
Sass: The Future of Stylesheets
Sass: The Future of StylesheetsSass: The Future of Stylesheets
Sass: The Future of Stylesheets
chriseppstein
 
LESS(CSS preprocessor)
LESS(CSS preprocessor)LESS(CSS preprocessor)
LESS(CSS preprocessor)
VIPIN KUMAR
 
Wordpress plugin development tips
Wordpress plugin development tipsWordpress plugin development tips
Wordpress plugin development tips
Mindfire Solutions
 
How to Contribute Code to MySQL?
How to Contribute Code to MySQL?How to Contribute Code to MySQL?
How to Contribute Code to MySQL?
Thava Alagu
 
Rupy2012 ArangoDB Workshop Part2
Rupy2012 ArangoDB Workshop Part2Rupy2012 ArangoDB Workshop Part2
Rupy2012 ArangoDB Workshop Part2
ArangoDB Database
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
OpusVL
 
Be Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - EcosystemBe Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - Ecosystem
Lucas Renan
 
Advanced WordPress Development Environments
Advanced WordPress Development EnvironmentsAdvanced WordPress Development Environments
Advanced WordPress Development Environments
Beau Lebens
 
PostgreSQL - It's kind've a nifty database
PostgreSQL - It's kind've a nifty databasePostgreSQL - It's kind've a nifty database
PostgreSQL - It's kind've a nifty database
Barry Jones
 
Configuring a more secure BOSH
Configuring a more secure BOSHConfiguring a more secure BOSH
Configuring a more secure BOSH
Saman Alvi
 
Cloud Computing Training
Cloud Computing TrainingCloud Computing Training
Cloud Computing Training
Deccansoft
 

Similar to LESS(CSS Pre Processor) introduction (20)

UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
kavi806657
 
LESS CSS
LESS CSSLESS CSS
LESS CSS
Mathi Rajalingam
 
Start using less css
Start using less cssStart using less css
Start using less css
Ali MasudianPour
 
Why less?
Why less?Why less?
Why less?
Bunlong Van
 
Introducing grunt, npm and sass
Introducing grunt, npm and sassIntroducing grunt, npm and sass
Introducing grunt, npm and sass
priyanka1452
 
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
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren
 
Scss talk CSS Meetup
Scss talk CSS Meetup Scss talk CSS Meetup
Scss talk CSS Meetup
Caleb Yang
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
Amey Parab
 
Less - an Introduction
Less - an IntroductionLess - an Introduction
Less - an Introduction
Jaydev Gajera
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compass
Nick Cooley
 
Advanced sass
Advanced sassAdvanced sass
Advanced sass
Kianosh Pourian
 
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)
Folio3 Software
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
David Engel
 
Sass_Cubet seminar
Sass_Cubet seminarSass_Cubet seminar
Sass_Cubet seminar
Cubet Techno Labs
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
Lucien Lee
 
[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX
European Collaboration Summit
 
Create SASSy web parts in SPFx
Create SASSy web parts in SPFxCreate SASSy web parts in SPFx
Create SASSy web parts in SPFx
Stefan Bauer
 
Deep dive into sass
Deep dive into sassDeep dive into sass
Deep dive into sass
Knoldus Inc.
 
Intro to Sass for WordPress Developers
Intro to Sass for WordPress DevelopersIntro to Sass for WordPress Developers
Intro to Sass for WordPress Developers
Suzette Franck
 
Introducing grunt, npm and sass
Introducing grunt, npm and sassIntroducing grunt, npm and sass
Introducing grunt, npm and sass
priyanka1452
 
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
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren
 
Scss talk CSS Meetup
Scss talk CSS Meetup Scss talk CSS Meetup
Scss talk CSS Meetup
Caleb Yang
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
Amey Parab
 
Less - an Introduction
Less - an IntroductionLess - an Introduction
Less - an Introduction
Jaydev Gajera
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compass
Nick Cooley
 
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)
Folio3 Software
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
David Engel
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
Lucien Lee
 
Create SASSy web parts in SPFx
Create SASSy web parts in SPFxCreate SASSy web parts in SPFx
Create SASSy web parts in SPFx
Stefan Bauer
 
Deep dive into sass
Deep dive into sassDeep dive into sass
Deep dive into sass
Knoldus Inc.
 
Intro to Sass for WordPress Developers
Intro to Sass for WordPress DevelopersIntro to Sass for WordPress Developers
Intro to Sass for WordPress Developers
Suzette Franck
 
Ad

Recently uploaded (20)

CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
TechSoup
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
Dr. Nasir Mustafa
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
The History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptxThe History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdfRanking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Rafael Villas B
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
TechSoup
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
Dr. Nasir Mustafa
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdfRanking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Rafael Villas B
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
Ad

LESS(CSS Pre Processor) introduction

  • 1. {less} ( C S S P R E P R O C E S S O R ) R U S H I R A J B R A H M B H AT T
  • 2. What is less? • Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques that allow you to make CSS that is more maintainable, themeable and extendable. • Less can run client side as well as server side. • Less can be pre-compiled into CSS. • At first less was written in Ruby ,later it was replaced by JavaScript.
  • 3. Digging LESS Features 1) VARIABLES 2) MIXINS a)Parametric Mixins 3) NESTING a) Nested Rules b) Conditional Nesting 4) PATTERN MATCHING 5) GUARD EXPRESSIONS (i.e. if statement)
  • 4. LESS Features Cont.. 6) Operators 7) Importing & File Paths 8) Functions a) Color Functions b) Math functions 9) NAMESPACES 10)SCOPE
  • 5. LESS Installation • Install Node.js in your PC. – https://nodejs.org/en/ • After installing node open command prompt to install LESS – npm install -g less • After installation you can invoke the less compiler from command line by using “lessc” – lessc your-file.less – By this you can see the output of CSS code in your command prompt only. • To generate .css file in your folder use – lessc your-file.less your-file.css – This will generate a CSS file in your folder containing LESS file.
  • 6. Less Installation Cont.. – Every time you make changes in LESS file you have to run this command to make changes in CSS too. – This will generate CSS file in your folder with auto generated pure CSS syntax from LESS syntax. • To automatically watch over the LESS file and make changes accordingly in to CSS file i. Install less-watch-compiler https://github.com/jonycheung/deadsimple-less- watch-compiler ii. In command Prompt • npm install -g less-watch-compiler iii. Go into your directory containing less file folder • less-watch-compiler [LESS-FILE-FOLDER] [CSS-FILE-FOLDER-YOU-WANT-TO-GENERATE]
  • 7. Less Installation Cont.. • This will watch over the folder in which .less file is there and will generate a folder containing .css file. – Example: • Less-watch-compiler LessFolder CSSFolder • You can also install less-autocompiler package in any editor you are using. – Add line of code //out: your-file.css on top of .less file, it will automatically generate .css file in your folder and will auto update as you update .less file.
  • 8. Less Installation Cont.. • Client-side is the easiest way to get started and good for developing with Less, but in production, when performance and reliability is important, it is good to pre-compile using node.js or one of the many third party tools available. • To start off, link your .less stylesheets with the rel attribute set to "stylesheet/less" – <link rel="stylesheet/less" type="text/css" href="styles.less" /> • Next, download less.js and include it in a <script></script> tag in the <head> element of your page: – <script src="less.js" type="text/javascript"></script> NOTE :Using less.js in the browser is great for development, but it's not recommended for production
  • 14. Pattern Matching Less Syntax CSS Syntax When there are two mixins with same name and different parameter sets, Less will match the parameter pattern and apply the mixin that matches.
  • 15. Guard Expressions(i.e. if) LESS Syntax CSS Syntax .myblock (@size) when (@size < 10){ font-size: @size; color: red; } .myblock (@size) when (@size > 20) and (@size < 30){ font-size: @size; color: green; } .myblock (@size) when (@size = 50),(@size=60){ font-size: @size; color: blue; } .block1{ .myblock(5); } .block2 { .myblock(15); } .block3 { .myblock(50); } .block1 { font-size: 5; color: red; } .block2 { font-size: 25; color: green; } .block3 { font-size: 50; color: blue; }
  • 17. Importing • If your less file is growing, you can make different less files of different sections and importing those less file into your main less file. • I have two files button.less and banner.less I have imported these files into my main.less file. • It is not necessary to write .less extension while importing, LESS is smart enough it will understand that imported files are less files.
  • 19. Color Function • LESS have color functions to play with colors. You can lighten the base color or saturate it, even you can mix two or more different colors. ✓ saturate(@color, @amount) ✓ desaturate(@color, @amount) ✓ lighten(@color, @amount) ✓ darken(@color, @amount) ✓ fadein(@color, @amount) ✓ fadeout(@color, @amount) ✓ fade(@color, @amount) ✓ spin(@color, @amount) ✓ mix(@color1, @color2, @weight) ✓ grayscale(@color) ✓ contrast(@color)
  • 20. Math Function • Math operations can be used for standard arithmetic or unit conversions. In addition to simple math, pre-processors also have complex math support such as ceiling, rounding, getting min or max value in a list etc. • LESS provides a couple of math functions you can use on number values: – round(1.67); // returns '2' – ceil(2.4); // returns '3' – floor(2.6); // returns '2' • If you need to turn a value into a percentage, you can do so with the percentage function: – percentage(0.5); // returns '50%'
  • 21. Namespaces Less Syntax CSS Syntax Very useful if you want to create your own CSS libraries or distribute CSS.
  • 22. Less Syntax CSS Syntax Scope is similar to other programming languages. Variables and mixins first looked up locally and then if not found it looks for them in the parent. Scopes
  • 23. Resource & Reference • http://lesscss.org/# • https://htmlmag.com/article/an-introduction-to-css-preprocessors-sass-less-stylus
  • 24. THANK YOU R U S H I R A J B R A H M B H AT T