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

Front-end Web Development — Ruby to the Rescue!

Front-end Web Development — Ruby to the Rescue!

Amr Tamimi

June 22, 2013
Tweet

More Decks by Amr Tamimi

Other Decks in Programming

Transcript

  1. Ordinary HTML page, but! <!DOCTYPE html> <html> <head> <title> Hello

    world! </title> </head> <body> <div class=”container” id=”main”> Some stuff here! </div> </body> </html>
  2. Ordinary HTML page, beautified! <!DOCTYPE html> <html> <head> <title> Hello

    world! </title> </head> <body> <div class=”container” id=”main”> Some stuff here! </div> </body> </html>
  3. <!DOCTYPE html> <html> <head> <title> Hello world! </title> </head> <body>

    <div class=”container” id=”main”> Some stuff here! </div> </body> </html> Do we have to? — always? Let’s get rid of them all!
  4. <!DOCTYPE html> <html> <head> <title> Hello world! </title> </head> <body>

    <div class=”container” id=”main”> Some stuff here! </div> </body> </html>
  5. <!DOCTYPE html> html head title Hello world! body div class=”container”

    id=”main” Some stuff here! Still familiar, ha?
  6. CSS .header { margin: 0 auto; color: #c1c1c1; } .header

    .logo { width: 200px; background: red; } .header .logo h1 { font-size: 28px; } p { color: #c1c1c1; }
  7. .header { margin: 0 auto; color: #c1c1c1; } .header .logo

    { width: 200px; background: red; } .header .logo h1 { font-size: 28px; } p { color: #c1c1c1; } CSS
  8. .header { margin: 0 auto; color: #c1c1c1; } .header .logo

    { width: 200px; background: red; } .header .logo h1 { font-size: 28px; } p { color: #c1c1c1; } CSS $text-color: #c1c1c1 .header margin: 0 auto color: $text-color .logo width: 200px background: red h1 font-size: 28px p color: $text-color SASS
  9. .header { margin: 0 auto; color: #c1c1c1; } .header .logo

    { width: 200px; background: red; } .header .logo h1 { font-size: 28px; } p { color: #c1c1c1; } CSS $text-color: #c1c1c1; .header { margin: 0 auto; color: $text-color; .logo { width: 200px; background: red; h1 { font-size: 28px; } } p { color: $text-color; } SCSS
  10. .header { margin: 0 auto; color: #c1c1c1; } .header .logo

    { width: 200px; background: red; } .header .logo h1 { font-size: 28px; } p { color: #c1c1c1; } CSS @text-color: #c1c1c1; .header { margin: 0 auto; color: @text-color; .logo { width: 200px; background: red; h1 { font-size: 28px; } } p { color: @text-color; } LESS
  11. Mixins Variables Nesting .header { width: 960px; } .header .logo

    { width: 200px; background: red; } .header { width: 960px; .logo { width: 200px; background: red; } } More!
  12. Mixins Variables Nesting .content-navigation { border-color: #3bbfce; color: #2ca2af; margin:

    8px; } $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); margin: $margin / 2; } More!
  13. Mixins Variables Nesting div.banner { float: left; margin-left: 10px; }

    @mixin left($dist) { float: left; margin-left: $dist; } div.banner { @include left(10px); } More!
  14. COMPASS A framework that sits atop Sass and tackles common

    stylesheet problems such as grid layouts, handling CSS3 vendor differences, and production environment stylesheet optimization. compass-style.org Image Sprites Collection of mixins and functions
  15. A simple and lightweight mixin library for Sass. bourbon.io neat.bourbon.io

    A lightweight semantic grid framework for Sass and Bourbon. BOURBON NEAT
  16. Sleek, intuitive, and powerful front- end framework for faster and

    easier web development. getbootstrap.com foundation.zurb.com The most advanced responsive front-end framework in the world. BOOTSTRAP FOUNDATION
  17. var square = function(x) { return x * x; };

    var cube = function(x) { return square(x) * x; }; JavaScript
  18. var square = function(x) { return x * x ;

    }; var cube = function(x) { return square(x) * x; }; JavaScript
  19. var square = function(x) { return x * x ;

    }; var cube = function(x) { return square(x) * x; }; JavaScript square = (x) -> x * x cube = (x) -> square(x) * x CoffeeScript
  20. PUT IT ALL TOGETHER! There are tons of frameworks and

    libraries for front-end web development.
  21. Transform your plain text into static websites and blogs. It

    got lots of community plugins that handle everything minifying, compiling sass/ coffee/haml... jekyllrb.com JEKYLL
  22. Middleman is a static site generator using all the shortcuts

    and tools in modern web development. middlemanapp.com MIDDLE MAN
  23. Considering Rails as a front-end framework — It has handy

    tools to start developing for front-end. rubyonrails.org RAILS Me and Twitter use Rails for front-end development!
  24. RAILS FOR FRONT-END THINGS YOU CAN DO WITH RAILS -Using

    layouts and templates -Using view partials -Assets pipeline -Sass and CoffeeScript already in the box -HAML and Slim can be added easily! -Minify and compress
  25. GUARD Guard is a command line tool to easily handle

    events on file system modifications — Filesystem watcher guardgem.org