Slide 1

Slide 1 text

Front End Team

Slide 2

Slide 2 text

Rachel Ober Core 2 Adam Christie Create Dan “With a Beard” Cicconi Events Joseph Natalzia Events Kelly Sly Front Door Peter Margaritoff Front Door

Slide 3

Slide 3 text

Front End Team • Work together with Product Design & Back End Developers • Set front end coding standards • Build reusable components (into the Pattern Guide) • Maintain Pattern Guide • Ensure consistency across entire product

Slide 4

Slide 4 text

WE ALSO MAKE THINGS LOOK PRETTY

Slide 5

Slide 5 text

Haml

Slide 6

Slide 6 text

What is Haml? • Lightweight markup language to describe XHTML • Designed to address many of the flaws in traditional template engines • Trying to make markup as elegant as it can be

Slide 7

Slide 7 text

Haml Example !!! %html{ :xmlns => "http://www.w3.org/1999/xhtml", :lang => "en", "xml:lang" => "en"} %head %title BoBlog %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"} %link{"rel" => "stylesheet", "href" => "main.css", "type" => "text/css"} %body #header %h1 BoBlog %h2 Bob's Blog #content - @entries.each do |entry| .entry %h3.title= entry.title %p.date= entry.posted.strftime("%A, %B %d, %Y") %p.body= entry.body #footer %p All content copyright © Bob

Slide 8

Slide 8 text

Example XHTML Output BoBlog

BoBlog

Bob's Blog

Halloween

Tuesday, October 31, 2006

Happy Halloween, glorious readers! I'm going to a party this evening... I'm very excited.

New Rails Templating Engine

Friday, August 11, 2006

There's a very cool new Templating Engine out for Ruby on Rails. It's called Haml.

All content copyright © Bob

Slide 9

Slide 9 text

Haml Fast Facts • White-space significant • Use 2 spaces for indentation • “%” starts a new tag • If you start a line with a css class/id (.class-name/#class-name) it assumes a
• “-” Executes Ruby code • “=” Displays the outputted Ruby code • Use Ruby helpers like image_tag instead of Haml tags like %img

Slide 10

Slide 10 text

(Some) Haml Gotchas • Haml isn’t great for large pieces of text. • In order to put a period after an anchor link you do this stupid thing: • Plus other “stuff” you’ll find in the Haml documentation… click = succeed ‘.’ do %a{ href: “thing” } here click here.

Slide 11

Slide 11 text

SVG

Slide 12

Slide 12 text

Scalable Vector Graphics

Slide 13

Slide 13 text

Why SVG? • SVG are basically images in code (XML) • Highly manipulatable with CSS • Ready for Retina and HD displays • Can be resized without artifacts • Product Design only has to create the asset once, Front End Team does the rest of the work

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

SVG Code Example

Slide 16

Slide 16 text

(Some) SVG Gotchas • You still need a PNG version to support old browsers • However, we have a script that does it for us (HUZZAH) • SVG straight out of Illustrator can have extra crap in them • Run it through an optimizer before sending to production • When using React, to inline SVG you need to make a separate .js file • Pattern Guide includes iconified classes (available “soon”) • Responsive SVG need proportional dimensions

Slide 17

Slide 17 text

CSS

Slide 18

Slide 18 text

We use Sass at Paperless Post

Slide 19

Slide 19 text

Why Sass? • Variables • @import • Mixins • @extend • You’re programming styles instead of just writing CSS

Slide 20

Slide 20 text

CSS Box Model (not as cute nor fun as kittens)

Slide 21

Slide 21 text

CSS Box Model

Slide 22

Slide 22 text

CSS Box Model with border-box

Slide 23

Slide 23 text

Box Model in Developer Tools

Slide 24

Slide 24 text

BEM Block - Element - Modifier

Slide 25

Slide 25 text

Why BEM? As our Front End team grew, we needed a way to communicate code without intersecting and over-writing each other all the time.

Slide 26

Slide 26 text

Block • Block is an independent entity, a "building block" of an application. • Blocks contain information about themselves and their children (block elements). • Blocks can be used on their own or as a part of other blocks.

Slide 27

Slide 27 text

Element • Element is a part of a block, that performs a certain function. • Block elements can only appear inside their respective blocks. Elements can be mandatory and optional.

Slide 28

Slide 28 text

• Modifiers are properties of blocks and elements; they change appearance or behavior of the elements, they are applied to. • Each modifier has a name and a value. Multiple modifiers can be applied simultaneously. Modifier

Slide 29

Slide 29 text

BEM Naming Conventions • Blocks: prefix-block-name • Elements: b-block-name_ _element-name • Modifiers: usually adding --modifier-name

Slide 30

Slide 30 text

CSS & JavaScript • Don’t closely couple style & behavior • Either use a js- prefix class • eg: js-dropdown-menu • Or use a data- attribute that can be targeted by JavaScript • eg: { data-javascript-hook: dropdown-menu }

Slide 31

Slide 31 text

CSS Specificity !important IDs Classes Elements inline Inline Styles normal IDs Classes Elements

Slide 32

Slide 32 text

Pattern Guide

Slide 33

Slide 33 text

Pattern Guide • “Modules” of code and style fitting the Brand designed to be reusable. • Available as a Ruby gem or npm package to be included in your apps.

Slide 34

Slide 34 text

No content