SlideShare una empresa de Scribd logo
1 de 46
Descargar para leer sin conexión
LessCSS
Myles Braithwaite
http://myles.coffee | me@myles.coffee | @MylesB
Behind every beautiful thing,
there's some kind of pain.
— Bob Dylan
What is LessCSS?
Why?
Ask anyone
CSS Sucks!
Not Really
But it's hard.
<h1 style="font-family:Helvetica;font-size:2em;font-weight:normal;">
<span style="font-weight:bold;">Myles</span>
<span style="display:none;">Alden</span>
<span>Braithwaite</span>
</h1>
How?
Variables
@black: #141414;
p {
color: @black;
}
Tangent
Design Tip: Never Use Black
by Ian Storm Taylor.
http://myles.github.io/2015-04-14-lesscss/black-vs-
black-web-site-text.html
http://myles.github.io/2015-04-14-lesscss/black-vs-
black-web-site-background.html
Built in Functions
@blue: rgb(0, 161, 226);
@dark-blue: darken(@blue, 10%);
@light-blue: lighten(@blue, 10%);
a {
color: @blue;
text-decoration: none;
border-bottom: 1px solid @dark-blue;
&:hover {
color: @dark-blue;
border-bottom-color: @blue;
}
&:active {
color: @light-blue;
border-bottom-color: @dark-blue;
}
}
Fuctions
— Miscellaneous: color, image-size, image-
width, image-height, convert, data-uri,
default, unit, get-unit, and svg-gradient.
— String: escape, e, % format, and replace.
— List: length and extract.
— Type: isnumber, isstring, iscolor,
iskeyword, isurl, ispixel, isem,
ispercentage, isunix, and isruleset.
Functions Math
— Math: ceil, floor, percentage, round, sqrt,
abs, sin, asin, cos, acos, tan, atan, pi, pow,
mod, min, and max.
Fuctions Colour
— Colour Definition: rgb, rgba, argb, hsl, hsla,
hsv, and hsva.
— Colour Channel: hue, saturation, lightness,
hsvhue, hsvsaturation, hsvvaule, red, green,
blue, alpha, luma, and luminance.
Fuctions Colour (continuted)
— Color Operation: saturate, desaturate,
lighten, darken, fadein, Colour, fade, spin,
mix, greyscale, and contrast.
— Colour Blending: multiply, screen, overlay,
softlight, hardlight, difference,
exclusion, average, and negation.
Loops
.make-columns(4);
.make-columns(@n, @i: 1) when (@i =< @n) {
.column-@{i} {
width: (@i * 100% / @n);
}
.generate-columns(@n, (@i + 1));
}
Outputs
.column-1 { width: 25%; }
.column-2 { width: 50%; }
.column-3 { width: 75%; }
.column-4 { width: 100%; }
Mixins
.min-resolution(@size) {
-webkit-min-device-pixel-ratio: @size;
-moz-device-pixel-ratio: @size;
min-resolution: @size;
}
.2x(@path, @w: auto, @h: auto) {
background-image: url(@path);
@2x_path: ~`@{path}.replace(/.w+$/, function(match) { return "@2x" + match; })`;
@media (.min-resolution(1.5px)) {
background-image: url("@{2x_path}");
background-size: @w @h;
}
}
Extend
article.pretty {
header {
h1 {
font-family: 'Sanchez', @serif-family;
}
}
section, footer {
font-family: 'Questrial', @sans-serif-family;
}
section {
color: @dark-gray;
}
footer {
color: @gray;
}
}
Extend Your Website With
BootstrapCSS
— Font-end Framework for web
sites.
— http://getbootstrap.com/
article.html
<main>
<article>
<header>
<h1>Article Title</h1>
</header>
<section>
<!-- the body of the article -->
</section>
<aside>
<!-- table of contents -->
</aside>
<footer>
<!-- author, published date, copyright -->
</footer>
</article>
</main>
_layout.less
/* _layout.less START */
main {
.container();
}
article {
.make-row();
}
header, footer {
.make-xs-column(12);
}
section {
.make-sm-column(8);
}
aside {
.make-sm-column(4);
.hidden-xs();
}
/* _layout.less END */
_typography.less
/* _typography.less START */
@font-family-base: 'Questrial', @font-family-sans-serif;
@headings-font-family: 'Sanchez', @font-family-serif;
article {
header {
.page-header();
}
section {
p {
&:first-of-type { .lead(); }
}
}
footer {
padding-top: ((@line-height-computed / 2) - 1);
margin: (@line-height-computed * 2) 0 @line-height-computed;
border-top: 1px solid @page-header-border-color;
}
}
/* _typography.less END */
_aside.less
/* _aside.less START */
article {
aside {
position: relative;
.inner {
position: fixed;
}
ul {
.nav();
.nav-pills();
.nav-stacked();
}
}
}
/* _aside.less END */
_logo.less
/* _logo.less START */
aside {
.logo {
.text-hide();
.thumbnail();
width: 170px;
height: 170px;
background-image: url('gtalug.png');
}
}
/* _logo.less END */
style.less
@import "bt/bootstrap.less";
@import "_layout.less";
@import "_typography.less";
@import "_aside.less";
@import "_logo.less";
style.css
/* _layout.less START */
main { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; }
@media (min-width: 768px) {
main { width: 750px; }
}
@media (min-width: 992px) {
main { width: 970px; }
}
@media (min-width: 1200px) {
main { width: 1170px; }
}
main > .navbar-header, main > .navbar-collapse { margin-right: -15px; margin-left: -15px; }
@media (min-width: 768px) {
main > .navbar-header, main > .navbar-collapse { margin-right: 0; margin-left: 0; }
}
article { margin-left: -15px; margin-right: -15px; }
header, footer { position: relative; float: left; width: 100%; min-height: 1px; padding-left: 15px; padding-right: 15px; }
section { position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px; }
@media (min-width: 768px) {
section { float: left; width: 66.66666667%; }
}
aside { position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px; }
@media (min-width: 768px) {
aside { float: left; width: 33.33333333%; }
}
@media (max-width: 767px) {
aside { display: none !important; }
}
/* _layout.less END */
style.css
/* _typography.less START */
article header { padding-bottom: 9px; margin: 40px 0 20px; border-bottom: 1px solid #eeeeee; }
article section p:first-of-type { margin-bottom: 20px; font-size: 16px; font-weight: 300; line-height: 1.4; }
@media (min-width: 768px) {
article section p:first-of-type { font-size: 21px; }
}
article footer { padding-top: 9px; margin: 40px 0 20px; border-top: 1px solid #eeeeee; }
/* _typography.less END */
style.css
/* _aside.less START */
article aside { position: relative; }
article aside .inner { position: fixed; }
article aside ul { margin-bottom: 0; padding-left: 0; list-style: none; }
article aside ul > li { position: relative; display: block; }
article aside ul > li > a { position: relative; display: block; padding: 10px 15px; }
article aside ul > li > a:hover, article aside ul > li > a:focus { text-decoration: none; background-color: #eeeeee; }
article aside ul > li.disabled > a { color: #777777; }
article aside ul > li.disabled > a:hover, article aside ul > li.disabled > a:focus {
color: #777777; text-decoration: none; background-color: transparent; cursor: not-allowed; }
article aside ul .open > a, article aside ul .open > a:hover, article aside ul .open > a:focus {
background-color: #eeeeee; border-color: #337ab7; }
article aside ul .nav-divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5; }
article aside ul > li > a > img { max-width: none; }
article aside ul > li { float: left; }
article aside ul > li > a { border-radius: 4px; }
article aside ul > li + li { margin-left: 2px; }
article aside ul > li.active > a, article aside ul > li.active > a:hover, article aside ul > li.active > a:focus {
color: #ffffff; background-color: #337ab7; }
article aside ul > li { float: none; }
article aside ul > li + li { margin-top: 2px; margin-left: 0; }
/* _aside.less END */
style.css
/* _logo.less START */
aside .logo { font: 0/0 a; color: transparent; text-shadow: none;
background-color: transparent; border: 0; display: block; padding: 4px;
margin-bottom: 20px; line-height: 1.42857143; background-color: #ffffff;
border: 1px solid #dddddd; border-radius: 4px;
-webkit-transition: border 0.2s ease-in-out;
-o-transition: border 0.2s ease-in-out;
transition: border 0.2s ease-in-out; width: 170px;
height: 170px; background-image: url('gtalug.png'); }
aside .logo > img, aside .logo a > img { margin-left: auto; margin-right: auto; }
aaside .logo:hover, aaside .logo:focus, aaside .logo.active { border-color: #337ab7; }
aside .logo .caption { padding: 9px; color: #333333; }
/* _logo.less END */
$ wc *.less
16 27 218 _aside.less
19 30 219 _layout.less
12 22 191 _logo.less
21 50 470 _typography.less
5 10 126 style.less
73 139 1224 total
$ lessc --clean-css style.less | wc
0 1496 119568
$ uncss http://127.0.0.1:8000/article.html > style.css
$ wc style.css
370 606 5426 style.css
$ yuicompressor style.css -o style.min.css
$ wc style.min.css
0 86 4348 style.min.css
Installation/Usage
Command Line
— npm install -g lessc
— lessc style.less > style.css
Client-side usage
<link rel="stylesheet/less" type="text/css" href="styles.less">
<script src="less.js" type="text/javascript"></script>
SassSyntactically Awesome Style Sheets
Variables
Sass
$color: #141414;
p {
color: $color;
}
Less
@color: #141414;
p {
color: @color;
}
Nesting
Sass and Less
a {
color: red;
&:hover {
color: blue;
}
}
Mixins
Sass
@mixin bordered {
border-top: dotted 1px black;
border-bottom: solid 2px black; }
span { @include bordered; }
Less
.bordered {
border-top: dotted 1px black;
border-bottom: solid 2px black; }
span { .bordered(); }
Selector Inheritance Sass Only
.bordered { border: 1px solid black; }
span.one { @extend .bordered; color: blue; }
span.two { @extend .bordered; color: red; }
Output
.bordered, span.one, span.two { border: 1px solid black; }
span.one { color: blue; }
span.two { color: red; }
Sass is pretty cool
And is worth it's own talk
Questions
Contact Me
— Web: http://myles.coffee/
— Email: me@myles.coffee
— Twitter: @MylesB
Attributions
— Black Cat photographed by Simon Law.

Más contenido relacionado

La actualidad más candente

Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Todd Zaki Warfel
 
HTML5 Boilerplate - PV219
HTML5 Boilerplate - PV219HTML5 Boilerplate - PV219
HTML5 Boilerplate - PV219GrezCZ
 
モダンなCSS設計パターンを考える
モダンなCSS設計パターンを考えるモダンなCSS設計パターンを考える
モダンなCSS設計パターンを考える拓樹 谷
 
Class 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleClass 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleErin M. Kidwell
 
Supercharged HTML & CSS
Supercharged HTML & CSSSupercharged HTML & CSS
Supercharged HTML & CSSMax Kraszewski
 
Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryTodd Zaki Warfel
 
LESS is More
LESS is MoreLESS is More
LESS is Morejsmith92
 
McrFRED 39 | CSS Processors
McrFRED 39 | CSS ProcessorsMcrFRED 39 | CSS Processors
McrFRED 39 | CSS ProcessorsTristan Ashley
 
Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSSRuss Weakley
 
CSS with LESS for #jd13nl
CSS with LESS for #jd13nlCSS with LESS for #jd13nl
CSS with LESS for #jd13nlHans Kuijpers
 
Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibilityjsmith92
 
Beyond CSS Architecture
Beyond CSS ArchitectureBeyond CSS Architecture
Beyond CSS Architecture拓樹 谷
 
Html structure
Html structureHtml structure
Html structureakkias
 

La actualidad más candente (20)

Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3
 
Document
DocumentDocument
Document
 
HTML5 Boilerplate - PV219
HTML5 Boilerplate - PV219HTML5 Boilerplate - PV219
HTML5 Boilerplate - PV219
 
モダンなCSS設計パターンを考える
モダンなCSS設計パターンを考えるモダンなCSS設計パターンを考える
モダンなCSS設計パターンを考える
 
Class 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleClass 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddle
 
Supercharged HTML & CSS
Supercharged HTML & CSSSupercharged HTML & CSS
Supercharged HTML & CSS
 
Theme04
Theme04Theme04
Theme04
 
Html5 ux london
Html5 ux londonHtml5 ux london
Html5 ux london
 
Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQuery
 
LESS is More
LESS is MoreLESS is More
LESS is More
 
McrFRED 39 | CSS Processors
McrFRED 39 | CSS ProcessorsMcrFRED 39 | CSS Processors
McrFRED 39 | CSS Processors
 
Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSS
 
CSS with LESS for #jd13nl
CSS with LESS for #jd13nlCSS with LESS for #jd13nl
CSS with LESS for #jd13nl
 
Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibility
 
This is a test
This is a testThis is a test
This is a test
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 
LESS
LESSLESS
LESS
 
Beyond CSS Architecture
Beyond CSS ArchitectureBeyond CSS Architecture
Beyond CSS Architecture
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Html structure
Html structureHtml structure
Html structure
 

Destacado

Destacado (8)

Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
extending-php
extending-phpextending-php
extending-php
 
GTALUG Short Talk On Mercurial
GTALUG Short Talk On MercurialGTALUG Short Talk On Mercurial
GTALUG Short Talk On Mercurial
 
Django GTALUG Presentation
Django GTALUG PresentationDjango GTALUG Presentation
Django GTALUG Presentation
 
The Internet and Your Business
The Internet and Your BusinessThe Internet and Your Business
The Internet and Your Business
 
GTALUG Presentation on CouchDB
GTALUG Presentation on CouchDBGTALUG Presentation on CouchDB
GTALUG Presentation on CouchDB
 
The Devil and HTML5
The Devil and HTML5The Devil and HTML5
The Devil and HTML5
 
Take a Stroll in the Bazaar
Take a Stroll in the BazaarTake a Stroll in the Bazaar
Take a Stroll in the Bazaar
 

Similar a LessCSS Presentation @ April 2015 GTALUG Meeting

HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptraghavanp4
 
Css 2c (2) (1) (1) (2)
Css 2c (2) (1) (1) (2)Css 2c (2) (1) (1) (2)
Css 2c (2) (1) (1) (2)gng542
 
Learn to Love CSS3 [English]
Learn to Love CSS3 [English]Learn to Love CSS3 [English]
Learn to Love CSS3 [English]ThemePartner
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & CompassAndreas Dantz
 
Learn to love CSS3 | Joomla! Day Deutschland
Learn to love CSS3 | Joomla! Day DeutschlandLearn to love CSS3 | Joomla! Day Deutschland
Learn to love CSS3 | Joomla! Day DeutschlandThemePartner
 
Making Links Magical Again with CSS
Making Links Magical Again with CSSMaking Links Magical Again with CSS
Making Links Magical Again with CSSJenn Lukas
 
Theme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieTheme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieRafaela Souza
 
Theme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieTheme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieRafaela Souza
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
 
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 NewsKaelig Deloumeau-Prigent
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESSjsmith92
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.Gabriel Neutzling
 

Similar a LessCSS Presentation @ April 2015 GTALUG Meeting (20)

HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
Css 2c (2) (1) (1) (2)
Css 2c (2) (1) (1) (2)Css 2c (2) (1) (1) (2)
Css 2c (2) (1) (1) (2)
 
Theme 23
Theme 23Theme 23
Theme 23
 
Learn to Love CSS3 [English]
Learn to Love CSS3 [English]Learn to Love CSS3 [English]
Learn to Love CSS3 [English]
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
Learn to love CSS3 | Joomla! Day Deutschland
Learn to love CSS3 | Joomla! Day DeutschlandLearn to love CSS3 | Joomla! Day Deutschland
Learn to love CSS3 | Joomla! Day Deutschland
 
Making Links Magical Again with CSS
Making Links Magical Again with CSSMaking Links Magical Again with CSS
Making Links Magical Again with CSS
 
Tmx9
Tmx9Tmx9
Tmx9
 
Theme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieTheme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copie
 
Theme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieTheme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copie
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
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
 
Dfdf
DfdfDfdf
Dfdf
 
Dfdf
DfdfDfdf
Dfdf
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
 
Documento
DocumentoDocumento
Documento
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.
 
Webtech File.docx
Webtech File.docxWebtech File.docx
Webtech File.docx
 

Último

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Último (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

LessCSS Presentation @ April 2015 GTALUG Meeting

  • 2. Behind every beautiful thing, there's some kind of pain. — Bob Dylan
  • 10. Tangent Design Tip: Never Use Black by Ian Storm Taylor.
  • 11.
  • 12.
  • 15. Built in Functions @blue: rgb(0, 161, 226); @dark-blue: darken(@blue, 10%); @light-blue: lighten(@blue, 10%); a { color: @blue; text-decoration: none; border-bottom: 1px solid @dark-blue; &:hover { color: @dark-blue; border-bottom-color: @blue; } &:active { color: @light-blue; border-bottom-color: @dark-blue; } }
  • 16. Fuctions — Miscellaneous: color, image-size, image- width, image-height, convert, data-uri, default, unit, get-unit, and svg-gradient. — String: escape, e, % format, and replace. — List: length and extract. — Type: isnumber, isstring, iscolor, iskeyword, isurl, ispixel, isem, ispercentage, isunix, and isruleset.
  • 17. Functions Math — Math: ceil, floor, percentage, round, sqrt, abs, sin, asin, cos, acos, tan, atan, pi, pow, mod, min, and max.
  • 18. Fuctions Colour — Colour Definition: rgb, rgba, argb, hsl, hsla, hsv, and hsva. — Colour Channel: hue, saturation, lightness, hsvhue, hsvsaturation, hsvvaule, red, green, blue, alpha, luma, and luminance.
  • 19. Fuctions Colour (continuted) — Color Operation: saturate, desaturate, lighten, darken, fadein, Colour, fade, spin, mix, greyscale, and contrast. — Colour Blending: multiply, screen, overlay, softlight, hardlight, difference, exclusion, average, and negation.
  • 20. Loops .make-columns(4); .make-columns(@n, @i: 1) when (@i =< @n) { .column-@{i} { width: (@i * 100% / @n); } .generate-columns(@n, (@i + 1)); } Outputs .column-1 { width: 25%; } .column-2 { width: 50%; } .column-3 { width: 75%; } .column-4 { width: 100%; }
  • 21. Mixins .min-resolution(@size) { -webkit-min-device-pixel-ratio: @size; -moz-device-pixel-ratio: @size; min-resolution: @size; } .2x(@path, @w: auto, @h: auto) { background-image: url(@path); @2x_path: ~`@{path}.replace(/.w+$/, function(match) { return "@2x" + match; })`; @media (.min-resolution(1.5px)) { background-image: url("@{2x_path}"); background-size: @w @h; } }
  • 22. Extend article.pretty { header { h1 { font-family: 'Sanchez', @serif-family; } } section, footer { font-family: 'Questrial', @sans-serif-family; } section { color: @dark-gray; } footer { color: @gray; } }
  • 23. Extend Your Website With BootstrapCSS — Font-end Framework for web sites. — http://getbootstrap.com/
  • 24. article.html <main> <article> <header> <h1>Article Title</h1> </header> <section> <!-- the body of the article --> </section> <aside> <!-- table of contents --> </aside> <footer> <!-- author, published date, copyright --> </footer> </article> </main>
  • 25. _layout.less /* _layout.less START */ main { .container(); } article { .make-row(); } header, footer { .make-xs-column(12); } section { .make-sm-column(8); } aside { .make-sm-column(4); .hidden-xs(); } /* _layout.less END */
  • 26. _typography.less /* _typography.less START */ @font-family-base: 'Questrial', @font-family-sans-serif; @headings-font-family: 'Sanchez', @font-family-serif; article { header { .page-header(); } section { p { &:first-of-type { .lead(); } } } footer { padding-top: ((@line-height-computed / 2) - 1); margin: (@line-height-computed * 2) 0 @line-height-computed; border-top: 1px solid @page-header-border-color; } } /* _typography.less END */
  • 27. _aside.less /* _aside.less START */ article { aside { position: relative; .inner { position: fixed; } ul { .nav(); .nav-pills(); .nav-stacked(); } } } /* _aside.less END */
  • 28. _logo.less /* _logo.less START */ aside { .logo { .text-hide(); .thumbnail(); width: 170px; height: 170px; background-image: url('gtalug.png'); } } /* _logo.less END */
  • 29. style.less @import "bt/bootstrap.less"; @import "_layout.less"; @import "_typography.less"; @import "_aside.less"; @import "_logo.less";
  • 30. style.css /* _layout.less START */ main { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } @media (min-width: 768px) { main { width: 750px; } } @media (min-width: 992px) { main { width: 970px; } } @media (min-width: 1200px) { main { width: 1170px; } } main > .navbar-header, main > .navbar-collapse { margin-right: -15px; margin-left: -15px; } @media (min-width: 768px) { main > .navbar-header, main > .navbar-collapse { margin-right: 0; margin-left: 0; } } article { margin-left: -15px; margin-right: -15px; } header, footer { position: relative; float: left; width: 100%; min-height: 1px; padding-left: 15px; padding-right: 15px; } section { position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px; } @media (min-width: 768px) { section { float: left; width: 66.66666667%; } } aside { position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px; } @media (min-width: 768px) { aside { float: left; width: 33.33333333%; } } @media (max-width: 767px) { aside { display: none !important; } } /* _layout.less END */
  • 31. style.css /* _typography.less START */ article header { padding-bottom: 9px; margin: 40px 0 20px; border-bottom: 1px solid #eeeeee; } article section p:first-of-type { margin-bottom: 20px; font-size: 16px; font-weight: 300; line-height: 1.4; } @media (min-width: 768px) { article section p:first-of-type { font-size: 21px; } } article footer { padding-top: 9px; margin: 40px 0 20px; border-top: 1px solid #eeeeee; } /* _typography.less END */
  • 32. style.css /* _aside.less START */ article aside { position: relative; } article aside .inner { position: fixed; } article aside ul { margin-bottom: 0; padding-left: 0; list-style: none; } article aside ul > li { position: relative; display: block; } article aside ul > li > a { position: relative; display: block; padding: 10px 15px; } article aside ul > li > a:hover, article aside ul > li > a:focus { text-decoration: none; background-color: #eeeeee; } article aside ul > li.disabled > a { color: #777777; } article aside ul > li.disabled > a:hover, article aside ul > li.disabled > a:focus { color: #777777; text-decoration: none; background-color: transparent; cursor: not-allowed; } article aside ul .open > a, article aside ul .open > a:hover, article aside ul .open > a:focus { background-color: #eeeeee; border-color: #337ab7; } article aside ul .nav-divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5; } article aside ul > li > a > img { max-width: none; } article aside ul > li { float: left; } article aside ul > li > a { border-radius: 4px; } article aside ul > li + li { margin-left: 2px; } article aside ul > li.active > a, article aside ul > li.active > a:hover, article aside ul > li.active > a:focus { color: #ffffff; background-color: #337ab7; } article aside ul > li { float: none; } article aside ul > li + li { margin-top: 2px; margin-left: 0; } /* _aside.less END */
  • 33. style.css /* _logo.less START */ aside .logo { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; display: block; padding: 4px; margin-bottom: 20px; line-height: 1.42857143; background-color: #ffffff; border: 1px solid #dddddd; border-radius: 4px; -webkit-transition: border 0.2s ease-in-out; -o-transition: border 0.2s ease-in-out; transition: border 0.2s ease-in-out; width: 170px; height: 170px; background-image: url('gtalug.png'); } aside .logo > img, aside .logo a > img { margin-left: auto; margin-right: auto; } aaside .logo:hover, aaside .logo:focus, aaside .logo.active { border-color: #337ab7; } aside .logo .caption { padding: 9px; color: #333333; } /* _logo.less END */
  • 34. $ wc *.less 16 27 218 _aside.less 19 30 219 _layout.less 12 22 191 _logo.less 21 50 470 _typography.less 5 10 126 style.less 73 139 1224 total $ lessc --clean-css style.less | wc 0 1496 119568
  • 35. $ uncss http://127.0.0.1:8000/article.html > style.css $ wc style.css 370 606 5426 style.css $ yuicompressor style.css -o style.min.css $ wc style.min.css 0 86 4348 style.min.css
  • 36. Installation/Usage Command Line — npm install -g lessc — lessc style.less > style.css Client-side usage <link rel="stylesheet/less" type="text/css" href="styles.less"> <script src="less.js" type="text/javascript"></script>
  • 38. Variables Sass $color: #141414; p { color: $color; } Less @color: #141414; p { color: @color; }
  • 39. Nesting Sass and Less a { color: red; &:hover { color: blue; } }
  • 40. Mixins Sass @mixin bordered { border-top: dotted 1px black; border-bottom: solid 2px black; } span { @include bordered; } Less .bordered { border-top: dotted 1px black; border-bottom: solid 2px black; } span { .bordered(); }
  • 41. Selector Inheritance Sass Only .bordered { border: 1px solid black; } span.one { @extend .bordered; color: blue; } span.two { @extend .bordered; color: red; } Output .bordered, span.one, span.two { border: 1px solid black; } span.one { color: blue; } span.two { color: red; }
  • 42.
  • 43. Sass is pretty cool And is worth it's own talk
  • 45. Contact Me — Web: http://myles.coffee/ — Email: me@myles.coffee — Twitter: @MylesB
  • 46. Attributions — Black Cat photographed by Simon Law.