98
Front End Workflow

Front End Workflow

Embed Size (px)

Citation preview

Page 1: Front End Workflow

Front End Workflow

Page 2: Front End Workflow
Page 3: Front End Workflow

My Journey

Where I’ve Come FromWhere I Am Now

What’s Next

Page 4: Front End Workflow

Matt Bailey@_mattbailey mattbailey.io

Page 5: Front End Workflow

Creative Director gpmd.co.uk

Page 6: Front End Workflow

Design

Front End Development

Page 7: Front End Workflow

My Journey

Page 8: Front End Workflow

Where I’ve Come From

Page 9: Front End Workflow

The Transition From Analogue To Digital

Page 10: Front End Workflow
Page 11: Front End Workflow
Page 12: Front End Workflow

Where I Am Now

Page 13: Front End Workflow

It’s still very much a journey

Learning new things on a daily basis

Page 14: Front End Workflow

Responsive Web Design

Page 15: Front End Workflow
Page 16: Front End Workflow

Responsive Web Design Has Created Significant Challenges

A Need For A More ‘Agile’ Approach In Our Design Process

Page 17: Front End Workflow
Page 18: Front End Workflow
Page 19: Front End Workflow
Page 20: Front End Workflow

Design & Development Tools Have Changed

Dramatically

Page 21: Front End Workflow
Page 22: Front End Workflow
Page 23: Front End Workflow

Countless Frameworks, Platforms, Content Management Systems, Site Generators etc.

Page 24: Front End Workflow
Page 25: Front End Workflow

Source code and version control management

Page 26: Front End Workflow

Consistent Development Environments

Page 27: Front End Workflow
Page 28: Front End Workflow

Multi-device testing

Page 29: Front End Workflow
Page 30: Front End Workflow

Dependency And Package Managers, Preprocessors, Build Tools, And Methodologies

Page 31: Front End Workflow
Page 32: Front End Workflow

Coding Languages, Coding Style And Methodologies

Page 33: Front End Workflow

CSS PreprocessorsLess

Sass (SCSS) Stylus

Page 34: Front End Workflow

Huge Increase In EfficiencyMore Like A ‘Proper’ Programming Language

VariablesMixins

Functions Extends

And so on…

Page 35: Front End Workflow

BEMBlock Element Modifier

Page 36: Front End Workflow

.block {}

.block__element {}

.block__element--modifier {}

Page 37: Front End Workflow

BEM helps us write CSS that…

Easy to scaleIs clear and obvious in its purpose

Is self-documenting

http://www.gpmd.co.uk/blog/our-approach-to-bem/

Page 38: Front End Workflow

ITCSSInverted Triangle CSS

Harry Roberts (CSS Wizardry)

Page 39: Front End Workflow

Settings Tools

Generic Base

Objects Vendor

Components Trumps

Page 40: Front End Workflow

A Highly Modular Way Of Structuring CSS

Starts With Low Specificity (HTML tags) RulesEnds With High Specificity/Complexity Rules

http://www.gpmd.co.uk/blog/scalable-css/

Page 41: Front End Workflow

my-project/ `- src/ `- styles/ |- settings/ # Variables |- tools/ # Functions, mixins etc. |- generic/ # Low-specificity (normalize) |- base/ # Unclassed HTML elements |- objects/ # Design-free objects & patterns |- vendor/ # Third party components |- components/ # Modules, widgets etc. (theme) `- trumps/ # Helper classes and overrides

Page 42: Front End Workflow

Sassbase

https://github.com/gpmd/sassbase

Page 43: Front End Workflow

Performance & Optimisation

Page 44: Front End Workflow

Image Optimisation & Delivery

Page 45: Front End Workflow

‘picture’ element, & ’srcset’ and ‘sizes’

Content Delivery Networks

Image Management Pipeline - Dynamically deliver different image sizes and file formats

(WebP, JPEGXR etc.) to end users

Page 46: Front End Workflow

Critical Rendering Path

Page 47: Front End Workflow

Methods And Best Practices For Improving The Render Time Of Our Pages

Minify/uglifying Remove render blocking CSS/JavaScript

Load JavaScript asynchronouslyInline critical CSS in the head

etc…

Page 48: Front End Workflow

A Hugely Diverse Role

Page 49: Front End Workflow

Coding Standards & Conventions

Style Guides and Pattern Libraries

Dependency Management & Package Managers

Build Systems

Regression Testing

Performance Optimisation

Continuous Integration

Documentation

Page 50: Front End Workflow

Designer & Front End Architect

Page 51: Front End Workflow

–Elyse Holladay

“I want to build systems, architectures. I want my users to be my fellow developer and

designers as much as the end user. I want to make a site where the code on the inside

looks as great as the outside, and make it easy to do things like theme, A/B test, and build

new modules.”

Page 52: Front End Workflow

Let’s Do This

Page 53: Front End Workflow
Page 54: Front End Workflow

Project Structure

Page 55: Front End Workflow

my-project/ # Project (Git) root | |- public_html/ # Web root | `- themes/ | `- my-theme/ # (dist) Build destination | |- src/ # Source files | |- bower_components/ # Front end components |- bower.json | |- node_modules/ # Build dependencies |- package.json | `- Gruntfile.js # Build config

Page 56: Front End Workflow

Dependency Management

Page 57: Front End Workflow

Build System Dependencies

Page 58: Front End Workflow

grunt grunt-autoprefixer grunt-concurrent grunt-contrib-clean grunt-contrib-concat grunt-contrib-copy grunt-contrib-cssmin grunt-contrib-imagemin grunt-contrib-jshint grunt-contrib-uglify grunt-contrib-watch grunt-csscss grunt-modernizr grunt-sass grunt-scss-lint grunt-spritesmith grunt-stylestats load-grunt-config jshint-stylish time-grunt

Page 59: Front End Workflow

Front End Components

Page 60: Front End Workflow

picturefill modernizr normalize.css normalize-opentype.css jquery respond jquery-hoverIntent smooth-scroll owl-carousel2 background-size-polyfill jquery-replacetext CSS3MultiColumn isotope imagesloaded tablesaw

Page 61: Front End Workflow

Build System

Page 62: Front End Workflow

Task Manager

Page 63: Front End Workflow

Gruntfile.js

load-grunt-config - separate out task configsbuild environments - ‘prod’ and ‘dev’

Page 64: Front End Workflow

module.exports = function(grunt) {

# Use load-grunt-config require('load-grunt-config')(grunt, {

jitGrunt: true, # Use fast plugin loader init: true, data: {

# $ grunt --env=prod (or) --env=dev env: grunt.option('env') || 'prod',

# src and dynamic dist locations project: { src: 'src', dist: '<% if (env === "prod") { %>tmp<% } else { %>dist<% } %>' } } }); };

Page 65: Front End Workflow

Grunt Task Configs In Separate Files

Page 66: Front End Workflow

my-project/ | |- grunt/ | |- sass.js | |- uglify.js | |- watch.js | `- # etc. | `- Gruntfile.js

Page 67: Front End Workflow

aliases.js

Page 68: Front End Workflow

module.exports = function(grunt, data) { var env = data.env || 'prod'; return { default: { # Default build tasks: [env] }, dev: { # Dev build tasks tasks: [ ‘concurrent:devFirst', 'concurrent:devSecond' ] }, prod: { # Production build tasks tasks: [ 'concurrent:prodFirst', 'concurrent:prodSecond' ] } }; };

Page 69: Front End Workflow

concurrent.js

Page 70: Front End Workflow

module.exports = { options: { limit: 3 }, devFirst: [ # 1st dev target 'clean:dev' ], devSecond: [ # 2nd dev target 'sass:dev', 'uglify:dev' ], prodFirst: [ # 1st production target 'clean:prod' ], prodSecond: [ # 2nd production target 'sass:prod', 'uglify:prod' ] };

Page 71: Front End Workflow

Sass Tasks

grunt-sass - Uses fast libsass compiler grunt-scss-lint - Lint your SCSS files

css-min - Efficient CSS minifier

Page 72: Front End Workflow

CSS Reporting Tasks

grunt-csscss - Find duplicated declarations grunt-stylestats - Evaluate & report CSS stats

Page 73: Front End Workflow

And the rest…

grunt-autoprefixergrunt-modernizr

grunt-contrib-concat grunt-contrib-imagemin

grunt-spritesmithgrunt-contrib-jshintgrunt-contrib-uglifygrunt-contrib-watch

etc…

Page 74: Front End Workflow

Gruntbase

https://github.com/gpmd/gruntbase

Page 75: Front End Workflow

Git Hooks

Page 76: Front End Workflow

post-merge

Runs after a `git merge` or `git pull`

Page 77: Front End Workflow

1. Checks for changed files 2. Runs npm install && npm prune 3. Runs bower install && bower prune 4. Runs grunt

Page 78: Front End Workflow

pre-commit

Runs before a `git commit`

Page 79: Front End Workflow

1. Runs grunt 2. Won’t commit if build fails

git commit -m “My Message” -n

Page 80: Front End Workflow

my-project/ | |- .git | `- hooks | |- post-merge -> ../../githooks/post-merge | `- pre-commit -> ../../githooks/pre-commit | `- githooks |- post-merge `- pre-commit

Page 81: Front End Workflow

Initial Setup

Page 82: Front End Workflow

setup.sh >

1. githooks.sh # Creates Git hook symlinks

2. build.sh # Installs dependencies and runs build

Page 83: Front End Workflow

What’s Next?

Page 84: Front End Workflow
Page 85: Front End Workflow

CSS Namespacing

Page 86: Front End Workflow

More transparent code

http://csswizardry.com/2015/03/more-transparent-ui-code-with-namespaces/

Page 87: Front End Workflow

o- # object c- # Component u- # utility t- # theme s- # Scope is-, has- # State _ # Hack js- # Javascript qa- # QA

Page 88: Front End Workflow

‘Living’ Style Guides

Page 89: Front End Workflow
Page 90: Front End Workflow

SC5 Styleguide Generator Hologram

Pattern LabFabricatorSourceJS

http://www.smashingmagazine.com/2015/04/an-in-depth-overview-of-living-style-guide-tools/

Page 91: Front End Workflow

Visual Regression Testing

Page 92: Front End Workflow
Page 93: Front End Workflow

BackstopJS

Resemble.js

PhantomCSS

Page 94: Front End Workflow

Deployment ServerContinuous Integration (Lite)

Page 95: Front End Workflow

One server for all builds

All the build tools and dependencies in one place

Push only built code to production server

Page 96: Front End Workflow

That’s All Folks

Page 97: Front End Workflow
Page 98: Front End Workflow

Thank Youspeakerdeck.com/mattbailey/front-end-workflow

@_mattbailey mattbailey.io