Top Banner
René Olivo Boston, MA April 14th, 2014 LESS Bootstrap Implementing the right way using
19
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Implementing bootstrap the right way using less (1)

René OlivoBoston, MA

April 14th, 2014

LESSBootstrapImplementing

the right way using

Page 2: Implementing bootstrap the right way using less (1)

Mobile FirstCSS Framework

Fluid

Grid

Accessibility

Prototyping

Page 3: Implementing bootstrap the right way using less (1)

The problemThis: Is the same as this:

Page 4: Implementing bootstrap the right way using less (1)

The problem

● It's not because they have the same number of lines.

● It's not because .row is similar to TR.● It's not because both are using a grid

system.

Page 5: Implementing bootstrap the right way using less (1)

The problem

We are defining how our website should behave right into the HTML.

.pull-left

.col-md-6

.img-responsive

.show

.clearfix

.hide

.pull-right

.img-circle

.col-sm-offset-2

.row

.sr-only

Page 6: Implementing bootstrap the right way using less (1)

Why is that a problem?

● It's difficult to integrate it to an existing project.

● It doesn't adapt well to new changes or requirements.

Page 7: Implementing bootstrap the right way using less (1)

Real life lessonBootstrap 2.x -> 3.x

Page 8: Implementing bootstrap the right way using less (1)
Page 9: Implementing bootstrap the right way using less (1)

¿What is LESS?

● Supercharged CSS.● It allows you to use:

○ Modularization○ Variables○ Functions○ Operators○ Nested selectors○ Conditions (Guards)○ Etc.

Page 10: Implementing bootstrap the right way using less (1)

LESS TutorialA short introduction

Page 11: Implementing bootstrap the right way using less (1)

How can LESS help Bootstrap?

Page 12: Implementing bootstrap the right way using less (1)

Separating content from behaviour

LESS removes Bootstrap completely from our HTML and takes it right into your CSS, where it belongs.

Page 13: Implementing bootstrap the right way using less (1)

You can use LESS awesome features

Using modules, variables, operators, mixins and functions improves considerably your workflow.

Page 14: Implementing bootstrap the right way using less (1)

Reduces the project's size

When you import only the modules that you will need for your project, you can reduce the Bootstrap file considerably.

What I want to use

What Bootstrap makes me use

20%

80%

Page 15: Implementing bootstrap the right way using less (1)

Functions (Mixins)

● .sr-only -> .sr-only();● .sr-only-focusable -> .sr-only-focusable();● .container -> .container();● .row -> .make-row();● .col-md-8 -> .make-md-column(8);● .col-md-offset-2 -> .make-md-column-offset(2)● .bg-info -> background: @brand-info;● .text-info -> color: @brand-info;

Page 16: Implementing bootstrap the right way using less (1)

Demo

Page 18: Implementing bootstrap the right way using less (1)

Q&A

Page 19: Implementing bootstrap the right way using less (1)

Thanks!