$30 off During Our Annual Pro Sale. View Details »

Front End Workflow

Matt Bailey
October 17, 2015

Front End Workflow

A look at current front end workflow - tools, techniques, methodologies.

Matt Bailey

October 17, 2015
Tweet

More Decks by Matt Bailey

Other Decks in Technology

Transcript

  1. Responsive Web Design Has Created Significant Challenges A Need For

    A More ‘Agile’ Approach In Our Design Process
  2. Huge Increase In Efficiency
 More Like A ‘Proper’ Programming Language

    Variables
 Mixins
 Functions
 Extends
 And so on…
  3. BEM helps us write CSS that… Easy to scale
 Is

    clear and obvious in its purpose
 Is self-documenting http://www.gpmd.co.uk/blog/our-approach-to-bem/
  4. A Highly Modular Way Of Structuring CSS Starts With Low

    Specificity (HTML tags) Rules
 Ends With High Specificity/Complexity Rules http://www.gpmd.co.uk/blog/scalable-css/
  5. 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
  6. ‘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
  7. Methods And Best Practices For Improving The Render Time Of

    Our Pages Minify/uglifying
 Remove render blocking CSS/JavaScript
 Load JavaScript asynchronously
 Inline critical CSS in the head
 etc…
  8. Coding Standards & Conventions Style Guides and Pattern Libraries Dependency

    Management & Package Managers Build Systems Regression Testing Performance Optimisation Continuous Integration Documentation
  9. –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.”
  10. 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
  11. 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
  12. 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<% } %>' } } }); };
  13. my-project/ | |- grunt/ | |- sass.js | |- uglify.js

    | |- watch.js | `- # etc. | `- Gruntfile.js
  14. 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' ] } }; };
  15. 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' ] };
  16. Sass Tasks grunt-sass - Uses fast libsass compiler
 grunt-scss-lint -

    Lint your SCSS files
 css-min - Efficient CSS minifier
  17. 1. Checks for changed files 2. Runs npm install &&

    npm prune 3. Runs bower install && bower prune 4. Runs grunt
  18. my-project/ | |- .git | `- hooks | |- post-merge

    -> ../../githooks/post-merge | `- pre-commit -> ../../githooks/pre-commit | `- githooks |- post-merge `- pre-commit
  19. setup.sh > 1. githooks.sh
 # Creates Git hook symlinks 2.

    build.sh
 # Installs dependencies and runs build
  20. o- # object c- # Component u- # utility t-

    # theme s- # Scope is-, has- # State _ # Hack js- # Javascript qa- # QA
  21. One server for all builds All the build tools and

    dependencies in one place Push only built code to production server