Share
Embed
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
Transcript
167 slides
-
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 -
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 ) -
Why these technologies? FAST • Reusable • Modular SMART •
Programmatic EFFICIENT • Local • Version Controlled • Streamlined Deployment -
Wh are you? What do you do & why are
you here? -
What Is Bootstrap? Bootstrap is an open-source library of design
components built with HTML, CSS and Javascript. -
Why Bootstrap? Easy to prototype sites Jumpstart your projects with
modular elements -
Why Bootstrap? Easy to prototype sites Jumpstart your projects with
modular elements Allow developers to make a pretty interface -
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. -
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/ -
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 ) -
What is Sass? Sass, which officially stands for Syntactically Awesome
Stylesheets, is a CSS preprocessing language. -
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. -
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): -
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) -
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) -
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. -
Why Sass? Hampton Catlin, the creator of Haml, built and
released Sass in 2007. -
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.” -
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. -
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). -
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. -
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 -
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 -
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; } -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
DANGER ZONE! $prop: border; .callout { background-color: #C0FFEE; $prop-top: 1px
solid #000; } SCSS ??? CSS -
Interpolation ( #{ $var } ) $prop: border; .callout {
background-color: #C0FFEE; #{$prop}-top: 1px solid #000; } SCSS .callout { background-color: #C0FFEE; border-top: 1px solid #000; } CSS -
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; } -
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 -
So Much More! lighten(red, 35%) darken(red, 50%) rgba(red, .3) grayscale(red)
invert(red) Color Functions -
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 -
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 -
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 -
How Do We Compile Sass? The sass RubyGem $ gem
install sass $ sass --watch styles.scss:styles.css -
How Do We Compile Sass? The sass RubyGem $ gem
install sass $ sass --watch styles.scss:styles.css GUI Compilers -
How Do We Compile Sass? The sass RubyGem $ gem
install sass $ sass --watch styles.scss:styles.css GUI Compilers -
How Do We Compile Sass? The sass RubyGem $ gem
install sass $ sass --watch styles.scss:styles.css GUI Compilers -
How Do We Compile Sass? The sass RubyGem $ gem
install sass $ sass --watch styles.scss:styles.css GUI Compilers -
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/ -
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 ) -
What Is Git? Git is a distributed revision control and
source code management (SCM) system with an emphasis on speed. -
What Is Git? Git is a distributed revision control and
source code management (SCM) system with an emphasis on speed. -
What Is Github? Github is a the world’s largest open
source community. -
Who is Hosted on Github Bootstrap Node jQuery html5-boilerplate Ruby
on Rails (49,518) (21,898) (20,642) (20,058) (18,340) -
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 ) -
What is Jekyll? Jekyll is “simple, blog aware, static site
generator.” Jekyll _includes _layouts _posts assets index.html -
What is Jekyll? Jekyll is “simple, blog aware, static site
generator.” Jekyll _includes _layouts _posts assets index.html _sites blog assets index.html -
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.” -
What is Jekyll? In November 2008, Tom Preston-Werner, cofounder and
CEO of GitHub, introduced Jekyll with a blog post and released the code. -
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.” -
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...” -
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.” -
Why Jekyll? Jekyll is static. • Minimal server and no
database calls necessary -
Why Jekyll? Jekyll is static. • Minimal server and no
database calls necessary • Doesn't require a caching layer -
Why Jekyll? Jekyll is static. • Minimal server and no
database calls necessary • Doesn't require a caching layer • Fast -
Why Jekyll? Jekyll is static. • Minimal server and no
database calls necessary • Doesn't require a caching layer • Fast • Secure -
Why Jekyll? Jekyll is static. • Minimal server and no
database calls necessary • Doesn't require a caching layer • Fast • Secure • Easier local testing -
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. -
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. -
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. -
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 -
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 -
Jekyll Structure <!DOCTYPE html> <html> <head> <title></title> </head> <body> <header>...</header>
{{ content }} <footer>...</footer> </body> </html> _layouts/default.html -
What is Jekyll? Jekyll is “a simple, blog aware, static
site generator." Jekyll _includes _layouts _posts assets index.html _sites blog assets index.html -
What is Jekyll? Jekyll is “a simple, blog aware, static
site generator." Jekyll _includes _layouts _posts assets index.html _sites blog assets index.html -
Jekyll Structure <!DOCTYPE html> <html> <head> <title></title> </head> <body> <header>...</header>
{{ content }} <footer>...</footer> </body> </html> _layouts/default.html -
Liquid Liquid is a templating language, aka a templating engine,
that was developed by Shopify for use on their own site. -
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. -
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: -
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 -
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 -
Liquid ( output markup ) <div class="container"> {{ content }}
</div> Liquid <div class="container"> <section> <h2>Contact Us!</h2> <p>...</p> </section> </div> Compiled HTML -
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> -
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’ --> -
Jekyll Structure <!DOCTYPE html> <html> <head> <title></title> </head> <body> <header>...</header>
{{ content }} <footer>...</footer> </body> </html> _layouts/default.html -
Jekyll Structure --- layout: default --- <div class="container"> <p>Not too
shabby, huh?</p> </div> index.html -
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 -
How Do We Compile Jekyll? The jekyll RubyGem And, um,
what’s a gem? -
How Do We Compile Jekyll? The jekyll RubyGem And, um,
what’s a gem? • Gems are Ruby programs and libraries distributed through RubyGems -
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 -
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! -
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. -
You did it! Thanks so much for joining us! [email protected]
@jackbouba [email protected] @aapljack