
SASS (Syntactically Awesome Stylesheets) è un metalinguaggio che permette di scrivere del codice CSS in modo più semplice, organizzato e con alcune comodità niente male (ad esempio l'utilizzo di variabili):
Sass is a meta-language on top of CSS that’s used to describe the style of a document cleanly and structurally, with more power than flat CSS allows. Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.
Detto questo è meglio vedere subito un esempio:
#menu
:margin 0
:list-style none
li
:float left
a
:display block
:float left
:padding 4px 8px
:text-decoration none
:color white
:background = !menu_bg
Come potete notare non c'è stato alcun sconvolgimento rispetto un CSS standard ed il codice rimane comunque comprensibile anche a chi non conoscere il metalinguaggio SASS; in questo caso è stata usata una variabile, il nesting e l'indentazione ottenendo così del codice pulito e senza ripetizioni.
Il sito permette anche di provare la conversione SASS->CSS dove si possono fare i primi esperimenti ed utilizzare anche le funzioni avanzate (operazioni aritmetiche sulle variabili, funzioni, ecc...).
E poi? Bhe, c'è anche Compass:
Compass is a stylesheet authoring framework that makes your stylesheets and markup easier to build and maintain. With compass, you write your stylesheets in Sass instead of CSS. Using the power of Sass Mixins and the Compass community, you can apply battle-tested styles from frameworks like Blueprint to your stylesheets instead of your markup.
Personalmente preferisco ancora scrivere del codice CSS puro, stando attendo alla pulizia, organizzazione, ecc... però per progetti di ampie dimensioni, il connubio tra SASS e Compass risulterà sicuramente molto utile.
Daniele Simonin 1 September 2009 alle 06:57 Trackback URI
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||
Scrivi un commento
Tags di formattazione: