Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build Right: Frontend Tooling @ CSS Dev Conf Ne...

Build Right: Frontend Tooling @ CSS Dev Conf New Orleans

Slides for the Frontend Tooling workshop at CSS Dev Conf in New Orleans.

Build Right

October 24, 2014
Tweet

More Decks by Build Right

Other Decks in Programming

Transcript

  1. PATH OF PAIN Traditional Painful Flow DESIGNER FRONTEND BUILDING LAUNCH!

    DEV A ! DEV C “DONE!” THIS PART SUCKS LAST SEC CHANGES
  2. The traditional web development workflow is fraught with variance, isolation,

    and errors. Modern frontend tooling provides solutions for most of these issues.
  3. “There’s a new set of baseline skills required in order

    to be successful as a front-end developer, and developers who don’t meet this baseline are going to start feeling more and more left behind…” —rmurphey.com/blog/2012/04/12/a-baseline- for-front-end-developers/
  4. You'll take a few steps backward in productivity when you

    begin. There's a net gain here, though.
  5. THE INTERNET IS A DEEP BLACK HOLE
 The thing we

    build can also keep us from doing notable work
  6. Productivity Strain ‣The best time to create a shortcut for

    an obtuse task is the moment you imagine that it could be faster. ‣It’s probably billable time.
  7. TEXT EDITORS A few signs you need a better editor:

    1. Your editor is writing code for you
  8. TEXT EDITORS A few signs you need a better editor:

    3. You’ve hit a skill ceiling
  9. Why Sublime? ‣Power user features ‣Keeps out of your way

    ‣Strong community ‣Sorta free ‣Gateway drug to Vim
  10. When you’re painting a picture, most of your time is

    spent with your paintbrush off the canvas.* * Drew Neil’s analogy
  11. .

  12. $ $

  13. Git supports rapid branching and merging [...] A core assumption

    in Git is that a change will be merged more often than it is written, as it is passed around various reviewers. Branches in git are very lightweight. http://marc.info/?l=linux- kernel&m=111288700902396
  14. DEFINING SOURCE CONTROL Source Control gives you: ‣The ability to

    collaborate with others on a single codebase ‣Manage any conflicts that collaboration brings ‣The ability to move code around in time.
  15. Version control is a system that records changes to a

    file or set of files over time so that you can recall specific versions later http://git-scm.com/book/en/Getting-Started-About- Version-Control
  16. “[In making Git] Take CVS as an example of what

    not to do; if in doubt, make the exact opposite decision." Torvalds http://en.wikipedia.org/wiki/Git_(software)
  17. Photoshop is the most widely used, and most well known.

    http://bradfrostweb.com/blog/post/the-post-psd-era/
  18. We don’t know how good we have it ‣Alerts to

    debug JavaScript alert("JavaScript is loaded!");
  19. “When you hit the ‘Inspect’ button, mousing around the page

    will reveal the source of the element under your cursor ‘in real time’. Having the source instantly expand to reveal what what you touch is quite fun - it gives one the sensation of panning for gold.” —Joe Hewitt, creator of Firebug http://joehewitt.com/2006/03/15/firebug-a-love-story
  20. styletil.es “Style Tiles are similar to the paint chips and

    fabric swatches an interior designer gets approval on before designing a room”
  21. sparkbox.github.io/style-prototype/ “…allow[s] a client to get a visual summary of

    a site’s design direction without creating multiple Photoshop comps or fully developing HTML pages.
  22. demo.pattern-lab.info/ Atoms can also include more abstract elements like color

    palettes, fonts and even more invisible aspects of an interface like animations.
  23. We should shift the bulk of our time toward the

    environment where our final deliverable will live.
  24. SEMANTIC SHIFT “the evolution of word usage — usually to

    the point that the modern meaning is radically different from the original usage” —http://en.wikipedia.org/wiki/Semantic_change
  25. MOUSE small gray rodent with a long tail or a

    plastic device used to navigate on a computer screen
  26. Why should we expect anything less from computer languages? ‣Incredible

    complexity ‣Rapid change in hardware ‣Rapid change in software
  27. THE PATH OF PAIN Our languages are flawed ‣HTML is

    redundant. ‣CSS is “flat”. ‣JavaScript is verbose.
  28. What, exactly? ‣Preprocessors are a way to write code in

    a friendly language. ‣The code then gets processed into something that browsers can understand.
  29. Less CSS .unstyled-link { text-decoration: none; } .toollist-item { .border-radius(5px);

    background-color: #7b81d1; a { &:extend(.unstyled-link); color: #000; } } .toollist-item { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; background-color: #7b81d1; } .toollist-item a { text-decoration: none; color: #000; }
  30. .toollist-item { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; background-color: #7b81d1;

    } .toollist-item a { text-decoration: none; color: #000; } Stylus CSS .unstyled-link text-decoration none .toollist-item border-radius 5px background-color #7b81d1 a @extend .unstyled-link color #000
  31. .unstyled-link { text-decoration: none; } .toollist-item { @include border-radius(5px); background-color:

    #7b81d1; a { @extend %unstyled-link; color: #000; } } Sass CSS .toollist-item { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; background-color: #7b81d1; } .toollist-item a { text-decoration: none; color: #000; }
  32. @mixin sb-media($query) { @if $no-mq-support{ @if $query < $serve-to-nomq-max-width{ @content;

    } } @else { @media ( 'min-width:' + $query ) { @content; } } }
  33. var number, summaryMarkup; number = 3 + 2; summaryMarkup =

    "<div class=\"content\">\n <p> \n Foo: " + number + "\n </p>\n</div>"; JS
  34. Grunt does all the things! ‣Process CSS ‣Process CoffeeScript ‣Process

    HTML ‣Reload a page when code changes ‣Minify code ‣So much more
  35. module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'),

    uglify: { options: { banner: '/*! <%= pkg.name %> <%=grunt.template.today("yyyy- mm-dd") %> */\n' }, build: { src: 'src/<%= pkg.name %>.js', dest: 'build/<%= pkg.name %>.min.js' } } }); // Load the plugin that provides the "uglify" task. grunt.loadNpmTasks('grunt-contrib-uglify'); // Default task(s). grunt.registerTask('default', ['uglify']); }; Everything lives in Gruntfile.js
  36. What is Bower? ‣Pull down almost any JS library via

    the command line ‣Not checking dependancies into the repp ‣Use Grunt to manipulate the libraries once Bower pulls them down
  37. { "name": "br-demo", "version": "0.1.0", "dependencies": { "jquery": "1.9.1", "js-md5":

    "~1.1.0", "d3": "3.4.2", "bootstrap": "2.3.2" } } Everything lives in bower.json
  38. Handlebars ‣Basic templating without a CMS ‣Brings automation power to

    markup (100’s of helpers) ‣Reduce repetition
  39. _tool-list-item.hbs <div class="tool-list-item" style="background-color: {{color}}"> <div class="tool-list-item--container"> <div class="tool-list-item--title">{{title}}</div> <div

    class="tool-list-item--entry"><a href="{{entry-anchor}}" title="{{entry}}">{{entry}}</a></div> {{#if notes}} <div class="tool-list-item--expander js-trigger-tool-list"> <span class="icon-plus tool-list-item--expander-icon"> <a href="#" title="Read more">Read more</a> </span> </div> {{/if}} </div> {{#if notes}} <div class="tool-list-item--dropdown js-list-dropdown"> <div class="tool-list-item--dropdown-content wysiwyg"> {{#markdown}}{{notes}}{{/markdown}} </div> </div> {{/if}} </div> Let’s write that once.
  40. […] what matters is if you can test any changes

    to your code fast enough. http://programmers.stackexchange.com/questions/ 139187/web-development-no-local-server-workflow
  41. Working Locally ‣Websites/apps load instantly ‣Work offline ‣Allows existing live

    sites to be up and functioning normally. ‣Catch errors before they get to staging or production.
  42. Vagrant ‣ Creates a VM to exactly replicate a production

    environment. ‣ Vagrant’s config can be checked into source control to replicate the environment across a team.
  43. Try a number of solutions to find one that fits

    your project, your team, and your workflow
  44. Getting Started ‣Android mobile device ‣iOS mobile device (iPod Touch

    works great) ‣A tablet: iPad Mini, Kindle Fire, or Google Nexus
  45. VIRTUALIZATION Mobile Device Emulation ‣iOS simulation with Xcode’s iOS Simulator

    ‣Android simulation with Google’s Android Emulator
  46. We default to using physical devices if possible, VM’s for

    IE, and Browserstack for everything else.
  47. require 'mina/git' set :repository, 'git://...' set :env_config, YAML.load_file('./config/env.yml') set :environment,

    ENV['on'] || env_config.fetch('default') desc 'Sets up Mina to deploy to the requested environment' task :environment do env_config.fetch(environment).each do |key, value| set key.to_sym, value.to_s end end task :setup => :environment do end desc "Deploys the current version to the server." task :deploy => :environment do deploy do invoke :'git:clone' invoke :'deploy:link_shared_paths' to :launch do end end end desc "Deploys the current version to the server." task :deploy => :environment do deploy do invoke :'git:clone' invoke :'deploy:link_shared_paths' to :launch do end end end deploy.rb
  48. staging: domain: staging.example.com deploy_to: /var/www/staging_site branch: master ssh_options: "-A" production:

    domain: example.com deploy_to: /var/www/site branch: production ssh_options: "-A" default: staging environments.yml