organize your assets with rails

51
@happynoff Organize your assets with Rails

Upload: simon-courtois

Post on 27-Jul-2015

134 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Organize your assets with Rails

@happynoff

Organize your assets with Rails

Page 2: Organize your assets with Rails

@happynoff

Simon Courtois

www.tinci.fr

happynoff

simonc

Page 3: Organize your assets with Rails

@happynoff

My CSS is a mess!

Page 4: Organize your assets with Rails

@happynoff

Let's tidy up!

Page 5: Organize your assets with Rails

@happynoff

See your design as components

Page 6: Organize your assets with Rails

@happynoff

Page 7: Organize your assets with Rails

@happynoff

Page 8: Organize your assets with Rails

@happynoff

Page 9: Organize your assets with Rails

@happynoff

Page 10: Organize your assets with Rails

@happynoff

Page 11: Organize your assets with Rails

@happynoff

Page 12: Organize your assets with Rails

@happynoff

Organizing components

Page 13: Organize your assets with Rails

@happynoff

app/assets/stylesheets/ components/ _navbar.scss _related-videos-item.scss

Page 14: Organize your assets with Rails

@happynoff

using sprockets* *the Rails Asset Pipeline

Page 15: Organize your assets with Rails

@happynoff

= require_tree ./components

Page 16: Organize your assets with Rails

@happynoff

Conventions?

Page 17: Organize your assets with Rails

@happynoff

BEM? SMACSS? SUITCSS?

Page 18: Organize your assets with Rails

@happynoff

WIP CSS

Page 19: Organize your assets with Rails

@happynoff

Greatly inspired by Medium https://gist.github.com/fat/a47b882eb5f84293c4ed

Page 20: Organize your assets with Rails

@happynoff

.componentName

.componentName-attributeName

.componentName--variantName

Page 21: Organize your assets with Rails

@happynoff

.is-open

.componentName.is-open

Page 22: Organize your assets with Rails

@happynoff

.u-depth1

Page 23: Organize your assets with Rails

@happynoff

.js-magicClick

Page 24: Organize your assets with Rails

@happynoff

Leverage SCSS

Page 25: Organize your assets with Rails

@happynoff

sprockets ▸ @import

Page 26: Organize your assets with Rails

@happynoff

@import 'components/avatar'; @import 'components/navbar';

Page 27: Organize your assets with Rails

@happynoff

Share variables and mixins

Page 28: Organize your assets with Rails

@happynoff

Colors

Page 29: Organize your assets with Rails

@happynoff

@import 'base/colors';

Page 30: Organize your assets with Rails

@happynoff

Which notation?

Page 31: Organize your assets with Rails

@happynoff

#RRGGBB

rgb(1, 2, 3) rgba(1, 2, 3, 0.4)

hsl(1, 2%, 3%) hsla(1, 2%, 3%, 0.4)

Page 32: Organize your assets with Rails

@happynoff

hsl: Hue Saturation Lightness

Page 33: Organize your assets with Rails

@happynoff

hsl(200, 50%, 50%)

hsl(200, 50%, 70%)

hsl(200, 50%, 30%)

Page 34: Organize your assets with Rails

@happynoff

$color-green: hsl(127, 58%, 45%);

$color-green--navbar: hsl(127, 58%, 35%)

Page 35: Organize your assets with Rails

@happynoff

Typography

Page 36: Organize your assets with Rails

@happynoff

@import 'base/type';

Page 37: Organize your assets with Rails

@happynoff

Limit the font sizes

Page 38: Organize your assets with Rails

@happynoff

$fontSize-small: 14px; $fontSize-medium: 16px; $fontSize-large: 20px; $fontSize-larger: 27px; $fontSize-jumbo: 80px;

Page 39: Organize your assets with Rails

@happynoff

Typefaces may vary!

Page 40: Organize your assets with Rails

@happynoff

$fontSize-main-medium: 16px; $fontSize-second-medium: 15px;

Page 41: Organize your assets with Rails

@happynoff

$fontWeight-normal: 400; $fontWeight-bold: 700; $fontWeight-extrabold: 900;

Page 42: Organize your assets with Rails

@happynoff

Mixins

Page 43: Organize your assets with Rails

@happynoff

@import 'base/mixins';

Page 44: Organize your assets with Rails

@happynoff

@mixin lg { @media (min-width: 1170px) { @content; } }

Page 45: Organize your assets with Rails

@happynoff

.magicBox { font-size: $fontSize-medium;

@include lg { font-size: $fontSize-large; } }

Page 46: Organize your assets with Rails

@happynoff

Bootstrap

Page 47: Organize your assets with Rails

@happynoff

@import 'base/bootstrap-override';

Page 48: Organize your assets with Rails

@happynoff

Find your conventions!

Page 49: Organize your assets with Rails

@happynoff

Try - Fail - Do better

Page 50: Organize your assets with Rails

@happynoff

Questions?

Page 51: Organize your assets with Rails

@happynoff

Thank you!