HAML und SASS. (und COMPASS) markup haiku vs. syntactically awesome stylesheets. Tobias Adam, Jan Krutisch mindmatters GmbH & Co.



Similar documents
Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

How To Create A Web Page On A Windows (For Free) With A Notepad) On A Macintosh (For A Freebie) Or Macintosh Web Browser (For Cheap) On Your Computer Or Macbook (

CST 150 Web Design I CSS Review - In-Class Lab

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

JJY s Joomla 1.5 Template Design Tutorial:

Introduction to web development and JavaScript

Level 1 - Clients and Markup

Web Authoring CSS. Module Descriptor

CIS 467/602-01: Data Visualization

How To Customize A Forum On Vanilla Forum On A Pcode (Forum) On A Windows (For Forum) On An Html5 (Forums) On Pcode Or Windows 7 (Forforums) On Your Pc

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

Last week we talked about creating your own tags: div tags and span tags. A div tag goes around other tags, e.g.,:

Introduction to Web Development

Chapter 7 Page Layout Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Contents. Downloading the Data Files Centering Page Elements... 6

Web layout guidelines for daughter sites of Scotland s Environment

Style & Layout in the web: CSS and Bootstrap

Advanced Online Media Dr. Cindy Royal Texas State University - San Marcos School of Journalism and Mass Communication

Development Perspective: DIV and CSS HTML layout. Web Design. Lesson 2. Development Perspective: DIV/CSS

for Modern Web Design Andy Blanchard / Chris Keller

CLEAN CODE FOR COMPLEX S

Web Design for Programmers. Brian Hogan NAPCS Slides and content 2008 Brian P. Hogan Do not reproduce in any form without permission

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

GUIDE TO CODE KILLER RESPONSIVE S

Module 6 Web Page Concept and Design: Getting a Web Page Up and Running

How to Properly Compose HTML Code : 1

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

Intro to Web Design. ACM UIUC

What is CSS? Official W3C standard for controlling presentation Style sheets rely on underlying markup structure

CS134 Web Site Design & Development. Quiz1

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

COMMONWEALTH OF PENNSYLVANIA DEPARTMENT S OF Human Services, INSURANCE, AND AGING

CSS. CSS - cascading style sheets CSS - permite separar num documento HTML o conteúdo do estilo. ADI css 1/28

Web Development 1 A4 Project Description Web Architecture

Links Getting Started with Widgets, Gadgets and Mobile Apps

Advanced Online Media Dr. Cindy Royal Texas State University - San Marcos School of Journalism and Mass Communication

HTML and CSS. Elliot Davies. April 10th,

WRITE BETTER HTML BY WRITING BETTER CSS

Coding Standards for Web Development

CHAPTER 10. When you complete this chapter, you will be able to:

How to Create a Mobile Responsive Template in ExactTarget

HOW Interactive Design Conference 2013

Chapter 1. Introduction to web development

Web Authoring. Module Descriptor

Web Design and Databases WD: Class 7: HTML and CSS Part 3

We automatically generate the HTML for this as seen below. Provide the above components for the teaser.txt file.

Responsive Web Design Creative License

Cross Site Scripting (XSS) and PHP Security. Anthony Ferrara NYPHP and OWASP Security Series June 30, 2011

Modern Web Development From Angle Brackets to Web Sockets

HTML Fundamentals IN THIS APPENDIX

Stylesheet or in-line CSS CSS attributes, used in stylesheets or in-line, can define:

Coding HTML Tips, Tricks and Best Practices

Advanced Web Design. Zac Van Note.

ICE: HTML, CSS, and Validation

Further web design: Cascading Style Sheets Practical workbook

Ninja Webtechnologies. Eray Basar, 9elements

Accessibility in e-learning. Accessible Content Authoring Practices

jquery Tutorial for Beginners: Nothing But the Goods

Code View User s Guide

The Essential Guide to HTML Design

Subject Tool Remarks What is JQuery. Slide Javascript Library

Outline of CSS: Cascading Style Sheets

8 STEPS TO CODE KILLER RESPONSIVE S

CSS for Page Layout. Key Concepts

{color:blue; font-size: 12px;}

Webentwicklung für s iphone

Differences between HTML and HTML 5

Fast track to HTML & CSS 101 (Web Design)

Joomla Templates 101 Barb Ackemann

Campaign Guidelines and Best Practices

How to make a custom Joomla template!

Advanced Web Development SCOPE OF WEB DEVELOPMENT INDUSTRY

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

DESIGNING MOBILE FRIENDLY S

Building a Horizontal Menu in Dreamweaver CS3 Using Spry R. Berdan

Testking.M Q

WordPress and HTML Basics

Symfony 2 Tutorial. Model. Neues Bundle erstellen: php app/console generate:bundle --namespace=blogger/blogbundle

Advanced Editor User s Guide

Create Your own Company s Design Theme

<?xml version= 1.0?> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN

Beginning Web Development with Node.js

Welcome to CSE 330 Crea0ve Progamming and Rapid Prototyping. Course Informa0on

Flare Tips and Tricks. Tips and tricks. Importing content Lists. Variables and snippets Condition tags Printed documentation WebHelp.

Web Design and Development ACS Chapter 9. Page Structure

In this chapter, you will learn how to...

jquery Sliding Image Gallery

ios App Development Using Cordova

MCH Strategic Data Best Practices Review

Web Design & Development - Tutorial 04

Smashing CSS: Professional Techniques for Modern Layout, Meyer, Eric A., Wiley, 2011; ISBN: (Recommended)

Web publishing: An introduction to CSS

Entrance exam for PBA in Web Development

Simply download Beepip from and run the file when it arrives at your computer.

any other form. the information on these sites is volatile and subject to constant changes. other records are created through these sites.

Chat Window Skinning Creation Guide

Google Analytics Social Plug-in Tracking

Basic tutorial for Dreamweaver CS5

WEB DEVELOPMENT IMMERSIVE HTML & WEB FUNDAMENTALS

Transcription:

Mit hotfixes von Carsten Bormann 2011-02-28, 2012-03-13 HAML und SASS (und COMPASS) markup haiku vs. syntactically awesome stylesheets Tobias Adam, Jan Krutisch mindmatters GmbH & Co. KG

HAML

(X)HTML Abstraction Markup Language

ERB = HTML = Tag-Suppe

HTML-Tags = Redundant

<div> </div>

<div> Redundant! </div>

ERB = Zu Nachsichtig

index.erb <%= render :partial => 'head' %>... <%= render :partial => 'foot' %> _head.erb <body> _foot.erb </body>

installation als rails plugin

> gem install haml > cd rails_app > haml --rails. > echo "gem haml" >>Gemfile > html2haml ex foo.html.erb foo.html.haml

Einfache Tags

%table %tr %td Hey there

%table %tr %td Hey there Magic! <table> <tr> <td>hey there</td> </tr> </table>

Selbstschließende Tags

%foo/ Magic! <foo/>

Automatisch für:! meta! img! link! script! br! hr

Whitespace-Kontrolle

%blockquote< %div Foo! Magic! <blockquote><div> Foo! </div></blockquote>

%img %img> %img Magic! <img /><img /><img />

Tag-Attribute

%head{ :name => "doc_head" } %script{ 'type' => "text/" + "javascript", :src => "javascripts/script_#{2 + 7}" } Magic! <head name='doc_head'> <script src='/docs/rdoc/javascripts/script_9' type='text/javascript'> </script> </head>

Attribut-Helper

def html_attrs(lang = 'en-us') { :xmlns => "http://www.w3.org/1999/xhtml", 'xml:lang' => lang, :lang => lang } end

%html{html_attrs('de-de')} Magic! <html lang='de-de' xml:lang='de-de' xmlns='http://www.w3.org/1999/xhtml'> </html>

IDs und Classes

#eins.zwei #drei.vier Hallo! Magic! <div id="eins"> <div class="zwei"> <div id="drei" class="vier">hallo!</div> </div> </div>

Auto-ID's und Klassen

%ul %li[@book, :foo] Book Magic! <ul> <li class="foo_book" id="foo_book_1"> Book </li> </ul>

Ruby FTW!

%p= "Yay".downcase Magic! <p>yay</p>

%p&= "<b>yay</b>".downcase Magic! <p><b>yay</b></p>

%p== #{n} Followers Magic! <p>120231373274987476 Followers</p>

- [1,2,3].each do i %p= i Magic! <p>1</p> <p>2</p> <p>3</p>

Filter

:markdown Header ====== Hallo, *Welt* Magic! <h1>header</h1> <p>hallo, <em>welt</em>

Filter! plain! javascript! escaped! ruby! preserve! erb! sass! textile! markdown! maruku! roll yer own

Kommentare

/ this is a comment Magic! <!-- This is a comment -->

/[if IE] a {:href => 'http://www.getfirefox.com/' } Get Firefox! Magic! <!--[if IE]> <a href="http://www.getfirefox.com/"> Get Firefox! </a> <![endif]-->

-# this is a comment

-# this is a comment Magic!

HAML und Rails Im Gemfile: gem haml-rails (automatically enables haml generators)

HAML vs. SLIM Rails node.js HAML JADE SLIM

But wait, there's more!

haml-lang.org http://haml.hamptoncatlin.com/docs/rdoc/classes/haml.html

SASS

Syntactically Awesome StyleSheets

Warum?

Keine Variablen

Keine Abstraktionen

Keine echten Kaskadierungen

stylesheets/sass/screen.sass Magic! stylesheets/screen.css

Die Basics

#main :color #0f0 :width 300px p :color #030 Magic! #main { color: #0f0; width: 300px; } #main p { color: #030; }

#main color: #0f0 width: 300px p color: #030 alternative syntax Magic! #main { color: #0f0; width: 300px; } #main p { color: #030; }

Elternreferenz

link a color: #0f0 &:hover color: #0ff Magic! a { color: #0f0; } a:hover { color: #0ff; }

Zusammengesetzte Styles

.box :border :top 1px solid black :bottom 5px solid black Magic!.box { border-top: 1px solid black; border-bottom: 5px solid black; }

Konstanten

Update needed!bg_color = #002244 body :background-color =!bg_color Magic! body { background-color: #002244; }

Achtung!!bg_color = #002244 body :background-color =!bg_color Magic! body { background-color: #002244; }

Arithmetik

!bg_color = #002244 body :background-color =!bg_color + #020202 Magic! body { background-color: #022446; }

Mixins

=standard-border :border 1px solid black :padding 5px #main +standard-border Magic! #main { border: 1px solid black; padding: 5px; }

Output Styles

.box{border-top:1px solid black;border-bottom:5px solid black}body{backgroundcolor:#002244}#main{color:lime;pbackground-color:lime;pcolor:#000000}#main{border:1px solid black;padding:5px} :compressed

Update needed Ausblick (HAML Edge)

Mixin-Argumente

=grid-unit-base(!gutter_width = 50px)

Kontrollstrukturen

@for!n from 1 through 15.grid_#{!n} +grid-width(!n, 15, 200px)

!last = true @if!last +last @else :margin-right = 20px

COMPASS

CSS Meta Framework

CSS-Frameworks! Blueprint! YUI-Grids! 960.gs (als Plugin)! YAML (geplant?)

COMPASS-Module! Reset! Utilities! Layout

SASS vs. LESS LESS ist aus der node.js-gemeinde Twitter Bootstrap basiert auf LESS gem boostrap-sass Jetzt auch im Rails Tutorial :-) (evtl. Kapitel 5 nochmal lesen)