This document provides an overview and introduction to advanced technologies for web design, including HAML, SASS, Compass, CoffeeScript, Rake, and Charleston. HAML and SASS are markup languages that can simplify and improve HTML and CSS. Compass is a CSS meta-framework built with SASS. CoffeeScript is a programming language that compiles to JavaScript. Rake is a build tool that can be used with these technologies. Charleston is a static site generator that bundles Rake rules for using HAML, SASS, and CoffeeScript together on a project. Installation and usage instructions are provided for each technology.
4. Backend Developer
• This presentation is a bit terminal-centric.
• Mac OS X:
• /Applications/Utilities/Terminal.app
• Windows:
• Command Line or cmd.exe
16. HAML
.editor_box class name
.chrome
%input#filename
%span.button#save_button Save
17. HAML
.editor_box class name
.chrome Implicit div
%input#filename
%span.button#save_button Save
18. HAML
.editor_box class name
.chrome Implicit div
%input#filename tag name, id name
%span.button#save_button Save
19. HAML
.editor_box class name
.chrome Implicit div
%input#filename tag name, id name
%span.button#save_button Save
tag, class, and id names
20. HAML
!!! 5
%head
%title haml demo
%body
%h1 hello
.content
%p
I am a paragraph.
:markdown
You can embed markdown in HAML, because HAML
isn't great at body text.
39. Compass
body#index %body#index
#headers #headers
#page-header
#page-header my groceries
+span(6) #files-header
link to groceries.csv
#files-header #description-header
+span(8) i need these to eat!
#description-header #content
+span(10) %ul#groceries
%li turkey cutlets
#content %li captain crunch
ul#groceries %li 12 green peppers
+no-bullets %li Brooklyn Local 1
40. Blueprint vs. Compass
• Blueprint: • Express structure as
classes in HTML
• Express layout as
classes in HTML • Do layout and
formatting in CSS
• Do text formatting in
CSS • Mix in Compass styles
where needed
• Don’t mess up the
Blueprint styles • Great way to build
stable layouts
• Marginally better than
tables
• Compass:
48. CoffeeScript
math = {
root: Math.sqrt,
math =
square: square,
root: Math.sqrt
cube: function(x) {
square: square
return x * square(x);
cube: (x) -> x * square x
}
};
49. CoffeeScript
• Indentation-based syntax
• Simpler function de nitions
• Simpler loops and conditionals
for roid in asteroids
for roid2 in asteroids when roid isnt roid2
roid.explode() if roid.overlaps roid2
51. CoffeeScript
• Not a “JavaScript framework” like
Prototype or jQuery
$('.navigation').click (e) ->
return if e.target.tagName.toLowerCase() is 'a'
if this isnt (current_nav and current_nav[0])
close_menus()
current_nav = $(this)
current_nav.addClass 'active'
false
53. Disclaimer
CoffeeScript is just for fun. Until it
reaches 1.0, there are no
guarantees that the syntax won't
change between versions.
http://jashkenas.github.com/coffee-script/
emphasis added
54. Disclaimer
CoffeeScript is just for fun. Until it
reaches 1.0, there are no
guarantees that the syntax won't
change between versions.
http://jashkenas.github.com/coffee-script/
emphasis added
55. Installation
• Mac OS X with homebrew:
1. brew install coffee-script
• Windows:
1. Please read http://bit.ly/coffee4win
75. Charleston
Creating a New Page
1. Create new HTML or HAML le in
your_project/pages
2. Link to new_page.html (even if it’s HAML) in
your existing pages
%a(href='new_page.html')
76. Charleston
Creating a New Stylesheet
1. Create new CSS or SASS le in
your_project/stylesheets
2. Reference stylesheets/your_stylesheet.css
(even if it’s SASS) in appropriate HTML les
%link(rel='stylesheet' type='text/css' href='stylesheets/screen.css')
77. Charleston
Creating a New Script
1. Create new JavaScript or CoffeeScript le in
your_project/javascripts
2. Reference javascripts/your_script.js (even if
it’s CoffeeScript) in appropriate HTML les
%script(type='text/javascript' src='javascripts/example.js')
78. Charleston
Adding an Image
1. Put the image le in your_project/images
2. Reference images/charleston_chew.jpg in
appropriate HTML les
%img(src='images/charleston_chew.jpg' alt='some candy’)
79. Charleston
• Each Charleston project is a separate
directory.
• You should aggressively version-control
these projects.
• The only les you need to upload are in
the output directory.
82. Photo Credits
All photos are of your friendly local historic mansion
landmark, Villa Vizcaya.
http://www. ickr.com/photos/gesteves/3336482837/
http://www. ickr.com/photos/mattkieffer/4671838772/
http://www. ickr.com/photos/portablematthew/21583071/
http://www. ickr.com/photos/spbutterworth/2755374263/
http://www. ickr.com/photos/gesteves/3337338344/
http://www. ickr.com/photos/italintheheart/4017460039/