hoodwink.d enhanced

Fri Aug 19

Dynamic CSS templates with Rails


Scott over at Lunchbox Software is working on a nice dynamic CSS generation API built on top of Jim Weirich’s Builder library.

Something like this


site_background = '#FAFAFA'
text_color      = '#7F7F7F'
lb_fonts        = 'Helvetica, Arial, sans_serif'

css.comment! ‘this is my css file’
css.body(:class => ‘foo’) {
css.background_color site_background
css.font_size ‘small’
css.font_family lb_fonts
css.line_height ‘18px’
css.color text_color
}


becomes

/* this is my css file */
body.foo {
  background-color: #FAFAFA;
  font-size: small;
  font-family: Helvetica, Arial, sans_serif;
  line-height: 18px;
  color: #7F7F7F;
}

#ruby-lang

10:09 AM < dblack> it's funny how one knows that certain questions on ruby-talk will get multiple identical simultaneous answers
10:09 AM < dblack> yet one answers anyway, because what if everyone else decided at the same time that they didn't have to?
10:09 AM < dblack> prisoner's dilemma, ruby-talk-style