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

Modern Web Dev Workshop

Modern Web Dev Workshop

Jack Bouba and Brian Middleton, Planet Argon's two front-end developers, taught a workshop about Bootstrap, Sass, GItHub, and Jekyll. Check out http://modernwebworkshop.com for details.

Planet Argon

May 06, 2013
Tweet

Other Decks in Technology

Transcript

  1. Schedule 9am - 11am: Introduction / Bootstrap 15 min BREAK

    11:15am - 1pm: Sass/SCSS 1 hr LUNCH 2pm - 3pm: Git/Github 15 min BREAK 3:15pm - 4:45pm: Jekyll 4:45pm - 5pm: Q/A
  2. Modern Web Dev Workshop Starter Files- modernwebworkshop.com/workshop-files.zip Example site- jackbouba.github.io

    Cheat Sheet- modernwebworkshop.com/reference.html Install Guide- modernwebworkshop.com/install-guide.pdf For Section One Please download starter files For Section Three Please install git ( git-scm.com ) For Section Two Please install Scout app ( mhs.github.io/scout-app ) For Section Four Please install jekyll ( gem install jekyll )
  3. Why these technologies? FAST • Reusable • Modular SMART •

    Programmatic EFFICIENT • Local • Version Controlled • Streamlined Deployment
  4. What Is Bootstrap? Bootstrap is an open-source library of design

    components built with HTML, CSS and Javascript.
  5. Why Bootstrap? Easy to prototype sites Jumpstart your projects with

    modular elements Allow developers to make a pretty interface
  6. Responsive Design Responsive design is a mix of CSS media

    queries and flexible images that will reorganize the content on a page according to the size of the browser window.
  7. Responsive Design Responsive design is a mix of CSS media

    queries and flexible images that will reorganize the content on a page according to the size of the browser window. Ethan Marcotte http://unstoppablerobotninja.com/
  8. Modern Web Dev Workshop Starter Files- modernwebworkshop.com/workshop-files.zip Example site- jackbouba.github.io

    Cheat Sheet- modernwebworkshop.com/reference.html Install Guide- modernwebworkshop.com/install-guide.pdf For Section One Please download starter files For Section Three Please install git ( git-scm.com ) For Section Two Please install Scout app ( mhs.github.io/scout-app ) For Section Four Please install jekyll ( gem install jekyll )
  9. What is Sass? Sass, which officially stands for Syntactically Awesome

    Stylesheets, is a CSS preprocessing language.
  10. What is Sass? Sass, which officially stands for Syntactically Awesome

    Stylesheets, is a CSS preprocessing language. CSS has limitations; Sass was created to give it some extra functionality.
  11. What is Sass? Sass, which officially stands for Syntactically Awesome

    Stylesheets, is a CSS preprocessing language. CSS has limitations; Sass was created to give it some extra functionality. There are 2 syntaxes (and 2 file extensions):
  12. What is Sass? Sass, which officially stands for Syntactically Awesome

    Stylesheets, is a CSS preprocessing language. CSS has limitations; Sass was created to give it some extra functionality. There are 2 syntaxes (and 2 file extensions): • The original Sass indented, terse syntax (.sass)
  13. What is Sass? Sass, which officially stands for Syntactically Awesome

    Stylesheets, is a CSS preprocessing language. CSS has limitations; Sass was created to give it some extra functionality. There are 2 syntaxes (and 2 file extensions): • The original Sass indented, terse syntax (.sass) • The default SCSS syntax (.scss)
  14. What is Sass? Sass, which officially stands for Syntactically Awesome

    Stylesheets, is a CSS preprocessing language. CSS has limitations; Sass was created to give it some extra functionality. There are 2 syntaxes (and 2 file extensions): • The original Sass indented, terse syntax (.sass) • The default SCSS syntax (.scss) CSS is valid SCSS.
  15. Why Sass? Hampton Catlin, the creator of Haml, built and

    released Sass in 2007. “Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.”
  16. Why Sass? Hampton Catlin, the creator of Haml, built and

    released Sass in 2007. “Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.” • Sass makes scaling easier.
  17. Why Sass? Hampton Catlin, the creator of Haml, built and

    released Sass in 2007. “Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.” • Sass makes scaling easier. • Sass can help keep code DRY (Don't Repeat Yourself).
  18. Why Sass? Hampton Catlin, the creator of Haml, built and

    released Sass in 2007. “Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.” • Sass makes scaling easier. • Sass can help keep code DRY (Don't Repeat Yourself). • Sass is just plain smarter than CSS.
  19. Nesting .container { background-color: #333; color: #000; .headline { font-weight:

    bold; text-transform: uppercase; span { display: inline-block; padding: 5px; } } } SCSS .container { background-color: #333; color: #000; } .container .headline { font-weight: bold; text-transform: uppercase; } .container .headline span { display: inline-block; padding: 5px; } CSS
  20. DANGER ZONE! .container { background-color: #FFF; .headline-wrap { width: 50%;

    .headline { color: #333; span { text-transform: uppercase; } } } } SCSS .container { background-color: #FFF; } .container .headline-wrap { width: 50%; } .container .headline-wrap .headline { color: #333; } .container .headline-wrap .headline span { text-transform: uppercase; } CSS
  21. Parent Selector (&) a { color: #333; &:hover { color:

    #550000; } &:active { color: #330000; } } SCSS a { color: #333; } a:hover { color: #550000; } a:active { color: #330000; } CSS a { color: #333; :hover { color: #550000; } :active { color: #330000; } } a { color: #333; } a :hover { color: #550000; } a :active { color: #330000; }
  22. Parent Selector (&) body { background-color: #DDD; &.light { background-color:

    #FFF; } } .container { width: 50%; &.narrow { width: 20%; } } SCSS body { background-color: #DDD; } body.light { background-color: #FFF; } .container { width: 50%; } .container.narrow { width: 20%; } CSS
  23. Variables ( $ ) $main-color: #DDD; $border-type: solid; .headline {

    color: $main-color; border: 1px $border-type #000; } footer { background-color: $main-color; border: 2px $border-type #333; } SCSS .headline { color: #DDD; border: 1px solid #000; } footer { background-color: #DDD; border: 2px solid #333; } CSS
  24. Variables ( $ ) $main-color: #ffa; $border-type: dashed; .headline {

    color: $main-color; border: 1px $border-type #000; } footer { background-color: $main-color; border: 2px $border-type #333; } SCSS .headline { color: #ffa; border: 1px dashed #000; } footer { background-color: #ffa; border: 2px dashed #333; } CSS
  25. Mixins ( @mixin / @include ) @mixin button-base { color:

    #333; display: inline-block; padding: 5px; } .btn { @include button-base; } .callout a { @include button-base; } SCSS .btn { color: #333; display: inline-block; padding: 5px; } .callout a { color: #333; display: inline-block; padding: 5px; } CSS
  26. Mixins ( @mixin / @include ) @mixin button-base($pad) { color:

    #333; display: inline-block; padding: $pad; } .btn { @include button-base(10px); } .callout a { @include button-base(5px); } SCSS .btn { color: #333; display: inline-block; padding: 10px; } .callout a { color: #333; display: inline-block; padding: 5px; } CSS
  27. Mixins ( @mixin / @include ) @mixin button-base($pad:5px) { color:

    #333; display: inline-block; padding: $pad; } .btn { @include button-base(10px); } .callout a { @include button-base; } SCSS .btn { color: #333; display: inline-block; padding: 10px; } .callout a { color: #333; display: inline-block; padding: 5px; } CSS
  28. Mixins ( @mixin / @include ) @mixin button-base($pad, $txt) {

    color: $txt; display: inline-block; padding: $pad; } .btn { @include button-base(10px, #333); } .callout a { @include button-base(5px, #555); } SCSS .btn { color: #333; display: inline-block; padding: 10px; } .callout a { color: #555; display: inline-block; padding: 5px; } CSS
  29. Interpolation ( #{ $var } ) $prop: border; .callout {

    background-color: #C0FFEE; #{$prop}-top: 1px solid #000; } SCSS .callout { background-color: #C0FFEE; border-top: 1px solid #000; } CSS
  30. Extend ( @extend ) and Placeholders ( % ) .warning

    { font-weight: bold; font-size: 1.5em; font-style: italic; } .error { @extend .warning; color: #FF0000; } SCSS .warning, .error { font-weight: bold; font-size: 1.5em; font-style: italic; } .error { color: #FF0000; } CSS %warning { font-weight: bold; font-size: 1.5em; font-style: italic; } .error { @extend %warning; color: #FF0000; } .error { font-weight: bold; font-size: 1.5em; font-style: italic; color: #FF0000; }
  31. Import ( @import ) .btn { background-color: #C0FFEE; display: inline-block;

    } buttons.scss .btn { background-color: #C0FFEE; display: inline-block; } .container { float: left; } styles.css @import "buttons"; .container { float: left; } styles.scss
  32. So Much More! round(143.3px) ceil(143.3px) percentage(50px/200px) 200px + 30px 350px

    - 80px Math lighten(red, 35%) darken(red, 50%) rgba(red, .3) grayscale(red) invert(red) Color Functions
  33. So Much More! round(143.3px) ceil(143.3px) percentage(50px/200px) 200px + 30px 350px

    - 80px Math @if @for @each @while Control Directives lighten(red, 35%) darken(red, 50%) rgba(red, .3) grayscale(red) invert(red) Color Functions
  34. So Much More! round(143.3px) ceil(143.3px) percentage(50px/200px) 200px + 30px 350px

    - 80px Math @if @for @each @while Control Directives .logo { width: 50%; @media (max-width: 700px) { width: 20%; } } Nested Media Queries lighten(red, 35%) darken(red, 50%) rgba(red, .3) grayscale(red) invert(red) Color Functions
  35. How Do We Compile Sass? The sass RubyGem $ gem

    install sass $ sass --watch styles.scss:styles.css
  36. How Do We Compile Sass? The sass RubyGem $ gem

    install sass $ sass --watch styles.scss:styles.css GUI Compilers
  37. How Do We Compile Sass? The sass RubyGem $ gem

    install sass $ sass --watch styles.scss:styles.css GUI Compilers
  38. How Do We Compile Sass? The sass RubyGem $ gem

    install sass $ sass --watch styles.scss:styles.css GUI Compilers
  39. How Do We Compile Sass? The sass RubyGem $ gem

    install sass $ sass --watch styles.scss:styles.css GUI Compilers
  40. How Do We Compile Sass? The sass RubyGem $ gem

    install sass $ sass --watch styles.scss:styles.css GUI Compilers http://mhs.github.io/scout-app/
  41. Modern Web Dev Workshop Starter Files- modernwebworkshop.com/workshop-files.zip Example site- jackbouba.github.io

    Cheat Sheet- modernwebworkshop.com/reference.html Install Guide- modernwebworkshop.com/install-guide.pdf For Section One Please download starter files For Section Three Please install git ( git-scm.com ) For Section Two Please install Scout app ( mhs.github.io/scout-app ) For Section Four Please install jekyll ( gem install jekyll )
  42. What Is Git? Git is a distributed revision control and

    source code management (SCM) system with an emphasis on speed.
  43. What Is Git? Git is a distributed revision control and

    source code management (SCM) system with an emphasis on speed.
  44. Who is Hosted on Github Bootstrap Node jQuery html5-boilerplate Ruby

    on Rails (49,518) (21,898) (20,642) (20,058) (18,340)
  45. Modern Web Dev Workshop Starter Files- modernwebworkshop.com/workshop-files.zip Example site- jackbouba.github.io

    Cheat Sheet- modernwebworkshop.com/reference.html Install Guide- modernwebworkshop.com/install-guide.pdf For Section One Please download starter files For Section Three Please install git ( git-scm.com ) For Section Two Please install Scout app ( mhs.github.io/scout-app ) For Section Four Please install jekyll ( gem install jekyll )
  46. What is Jekyll? Jekyll is “simple, blog aware, static site

    generator.” Jekyll _includes _layouts _posts assets index.html
  47. What is Jekyll? Jekyll is “simple, blog aware, static site

    generator.” Jekyll _includes _layouts _posts assets index.html _sites blog assets index.html
  48. What is Jekyll? “You can think of Jekyll as a

    normalish dynamic blog but rather than parsing content, templates, and tags on each request, Jekyll does this once beforehand and caches the entire website in a folder for serving statically.”
  49. What is Jekyll? In November 2008, Tom Preston-Werner, cofounder and

    CEO of GitHub, introduced Jekyll with a blog post and released the code.
  50. What is Jekyll? In November 2008, Tom Preston-Werner, cofounder and

    CEO of GitHub, introduced Jekyll with a blog post and released the code. “I was tired of complicated blogging engines...I wanted to write great posts, not...lag behind the latest software release.”
  51. What is Jekyll? In November 2008, Tom Preston-Werner, cofounder and

    CEO of GitHub, introduced Jekyll with a blog post and released the code. “I was tired of complicated blogging engines...I wanted to write great posts, not...lag behind the latest software release.” “First, all my writing would be stored in a Git repository. Complexity would be kept to an absolute minimum...”
  52. What is Jekyll? In November 2008, Tom Preston-Werner, cofounder and

    CEO of GitHub, introduced Jekyll with a blog post and released the code. “I was tired of complicated blogging engines...I wanted to write great posts, not...lag behind the latest software release.” “First, all my writing would be stored in a Git repository. Complexity would be kept to an absolute minimum...” “Jekyll is a simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile [or Markdown] and Liquid converters, and spits out a complete, static website.”
  53. Why Jekyll? Jekyll is static. • Minimal server and no

    database calls necessary • Doesn't require a caching layer
  54. Why Jekyll? Jekyll is static. • Minimal server and no

    database calls necessary • Doesn't require a caching layer • Fast
  55. Why Jekyll? Jekyll is static. • Minimal server and no

    database calls necessary • Doesn't require a caching layer • Fast • Secure
  56. Why Jekyll? Jekyll is static. • Minimal server and no

    database calls necessary • Doesn't require a caching layer • Fast • Secure • Easier local testing
  57. Why Jekyll? Jekyll is static. • Minimal server and no

    database calls necessary • Doesn't require a caching layer • Fast • Secure • Easier local testing Organize your code (into templates and partials) for scaling and reusability.
  58. Why Jekyll? Jekyll is static. • Minimal server and no

    database calls necessary • Doesn't require a caching layer • Fast • Secure • Easier local testing Organize your code (into templates and partials) for scaling and reusability. Jekyll is built into GitHub Pages - host your Jekyll site for free.
  59. Why Jekyll? Jekyll is static. • Minimal server and no

    database calls necessary • Doesn't require a caching layer • Fast • Secure • Easier local testing Organize your code (into templates and partials) for scaling and reusability. Jekyll is built into GitHub Pages - host your Jekyll site for free. Write in Textile or Markdown.
  60. Textile and Markdown # Level One Headline ## Level Two

    Headline ### Level Three Headline This a parapraph full of **bold** and *italic* text, and a [link] (http://url.com) as well. * List item 1 * List item 2 Markdown <h1>Level One Headline</h1> <h2>Level Two Headline</h2> <h3>Level Three Headline</h3> <p>This is a paragraph full of <strong>bold</strong> and <em>italic</em> text, and a <a href=”http://url.com”>link</a> as well.</p> <ul> <li>First list item</li> <li>Second list item</li> </ul> Compiled HTML h1. Level One Headline h2. Level Two Headline h3. Level Three Headline This is a paragraph full of *bold* and _italic_ text, and a “link”:http://url.com as well. * List item 1 * List item 2 Textile
  61. Jekyll Structure <!DOCTYPE html> <html> <head> <title></title> </head> <body> <header>...</header>

    {{ content }} <footer>...</footer> </body> </html> Jekyll Compiled ( _site ) _layouts/default.html --- layout: default --- <div class="container"> <p>Not too shabby, huh?</p> </div> index.html <!DOCTYPE html> <html> <head> <title></title> </head> <body> <div class="container"> <p>Not too shabby, huh?</p> </div> </body> </html> index.html
  62. Jekyll Structure <!DOCTYPE html> <html> <head> <title></title> </head> <body> <header>...</header>

    {{ content }} <footer>...</footer> </body> </html> _layouts/default.html
  63. What is Jekyll? Jekyll is “a simple, blog aware, static

    site generator." Jekyll _includes _layouts _posts assets index.html _sites blog assets index.html
  64. What is Jekyll? Jekyll is “a simple, blog aware, static

    site generator." Jekyll _includes _layouts _posts assets index.html _sites blog assets index.html
  65. Jekyll Structure <!DOCTYPE html> <html> <head> <title></title> </head> <body> <header>...</header>

    {{ content }} <footer>...</footer> </body> </html> _layouts/default.html
  66. Liquid Liquid is a templating language, aka a templating engine,

    that was developed by Shopify for use on their own site.
  67. Liquid Liquid is a templating language, aka a templating engine,

    that was developed by Shopify for use on their own site. Templating languages include Haml, ERB, Handlebars, Jade, etc.
  68. Liquid Liquid is a templating language, aka a templating engine,

    that was developed by Shopify for use on their own site. Templating languages include Haml, ERB, Handlebars, Jade, etc. There are 2 types of Liquid markup:
  69. Liquid Liquid is a templating language, aka a templating engine,

    that was developed by Shopify for use on their own site. Templating languages include Haml, ERB, Handlebars, Jade, etc. There are 2 types of Liquid markup: • Output Markup
  70. Liquid Liquid is a templating language, aka a templating engine,

    that was developed by Shopify for use on their own site. Templating languages include Haml, ERB, Handlebars, Jade, etc. There are 2 types of Liquid markup: • Output Markup • Tag Markup
  71. Liquid ( output markup ) <div class="container"> {{ content }}

    </div> Liquid <div class="container"> <section> <h2>Contact Us!</h2> <p>...</p> </section> </div> Compiled HTML
  72. Liquid ( tag markup ) <p>Hi there {% comment %}

    you sack of potatoes {% endcomment %} </p> Liquid <p>Hi there</p> Compiled HTML <h2> {% if user.name == 'Jack' %} Hello Jack! {% else %} Hello Friend! {% endif %} </h2> <p>Hello Jack</p>
  73. Liquid <!-- Liquid does LOGIC --> {% if user %}

    Hello {{ user.name }} {% endif %} {% for item in array %} {{ item }} {% endfor %} <!-- Liquid does FILTERS --> {{ 'Brian Middleton!' | prepend:'Hi there' }} <!-- outputs ‘Hi there Brian Middleton!’ --> {{ 'Supercalifragilisticexpialidocious' | truncate:'5' }} <!-- ouputs ‘Super’ --> {{ 'Hey there dude!' | replace:'dude','buddy' }} <!-- outputs ‘Hey there buddy!’ --> <!-- Jekyll does Liquid Extensions --> {{ 'This is my first paragraph.' | number_of_words }} <!-- outputs ‘5’ -->
  74. Jekyll Structure <!DOCTYPE html> <html> <head> <title></title> </head> <body> <header>...</header>

    {{ content }} <footer>...</footer> </body> </html> _layouts/default.html
  75. Jekyll Structure <!DOCTYPE html> <html> <head> <title></title> </head> <body> <header>...</header>

    {{ content }} <footer>...</footer> </body> </html> Jekyll Compiled ( _site ) _layouts/default.html --- layout: default --- <div class="container"> <p>Not too shabby, huh?</p> </div> index.html <!DOCTYPE html> <html> <head> <title></title> </head> <body> <div class="container"> <p>Not too shabby, huh?</p> </div> </body> </html> index.html
  76. How Do We Compile Jekyll? The jekyll RubyGem And, um,

    what’s a gem? • Gems are Ruby programs and libraries distributed through RubyGems
  77. How Do We Compile Jekyll? The jekyll RubyGem And, um,

    what’s a gem? • Gems are Ruby programs and libraries distributed through RubyGems $ gem install jekyll $ jekyll build
  78. How Do We Compile Jekyll? The jekyll RubyGem And, um,

    what’s a gem? • Gems are Ruby programs and libraries distributed through RubyGems $ gem install jekyll $ jekyll build “Every GitHub Page is run through Jekyll when you push content to your repo.” GitHub Pages will compile our Jekyll site for us. MAGIC!
  79. Jekyll Commands $ jekyll build $ jekyll serve $ jekyll

    serve --watch The jekyll build command compiles our site. jekyll serve fires up a server that will host your _site directory. The --watch flag tells Jekyll to rebuild the site whenever files are modified.