Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
CascadingRubies
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  17 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tim Morgan  
View profile  
 More options Jun 2, 11:05 pm
From: Tim Morgan <seve...@gmail.com>
Date: Tue, 2 Jun 2009 22:05:07 -0500
Local: Tues, Jun 2 2009 11:05 pm
Subject: CascadingRubies
I just put some code up on GitHub I'd like to get some feedback on...

http://github.com/seven1m/cascading_rubies

Basically, it's a Ruby DSL that allows you to write CSS fairly easily.
Here's an example:

header {
  background_color '#eee'
  margin_bottom '10px'
  nav {
    border '1px solid #000'
    a(:link, :active, :visited) { color 'blue' }
    a(:hover) { color 'red' }
  }
  div.search {
    float 'right'
  }

}

Output:

#header { background-color: #eee; margin-bottom: 10px; }
#header #nav { border: 1px solid #000; }
#header #nav a:link, #header #nav a:active, #header #nav a:visited {
color: blue; }
#header #nav a:hover { color: red; }
#header div.search { float: right; }

This started as an experiment, and turned out to be something I think
could be useful. Of course, there are some (documented) shortcomings.
Just wondering what you guys think. Would you use something like this?
Does it need a Rails plugin?

Thanks.

Oh and BTW, we have a meeting planned for June 15th. Is that a good
date for everyone? Any ideas for presentations?

-Tim


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Hornbeck  
View profile  
 More options Jun 2, 11:09 pm
From: John Hornbeck <hornb...@gmail.com>
Date: Tue, 2 Jun 2009 22:09:09 -0500
Local: Tues, Jun 2 2009 11:09 pm
Subject: Re: [tulsa.rb] CascadingRubies

do you see an advantage of this over SASS? Just curious of your reasoning
behind doing it yourself as opposed to using a very popular library that
already does something like this.

--
John Hornbeck
Support Manager
Engine Yard
http://engineyard.com

“Work hard to find something that fascinates you.” - Richard Feynman


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Richter  
View profile  
 More options Jun 2, 11:55 pm
From: Justin Richter <jrich...@jetfive.com>
Date: Tue, 2 Jun 2009 22:55:34 -0500
Local: Tues, Jun 2 2009 11:55 pm
Subject: Re: [tulsa.rb] Re: CascadingRubies

It looks simple enough, but I have to echo Hornbeck's post.  One thing I
like about SASS is that you don't have to use curly brackets.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Richter  
View profile  
 More options Jun 3, 12:03 am
From: Justin Richter <jrich...@jetfive.com>
Date: Tue, 2 Jun 2009 23:03:40 -0500
Local: Wed, Jun 3 2009 12:03 am
Subject: Re: [tulsa.rb] Re: CascadingRubies

What made you want to create it?  Just curious.

On Tue, Jun 2, 2009 at 10:55 PM, Justin Richter <jrich...@jetfive.com>wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joseph A Holsten  
View profile  
 More options Jun 3, 12:08 am
From: Joseph A Holsten <jos...@josephholsten.com>
Date: Tue, 2 Jun 2009 23:08:11 -0500
Local: Wed, Jun 3 2009 12:08 am
Subject: Re: [tulsa.rb] Re: CascadingRubies
I think I like the spirit of this over SASS for the same reason I like  
markaby/builder over haml. It's a ruby internal dsl, not an external  
dsl with a new syntax. Clearly it's not as complete as sass, but I'd  
feel more at home extending this to do crazy stuff.

Justin: there's always do ... end; :)

On Jun 2, 2009, at 10:55 PM, Justin Richter wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Hornbeck  
View profile  
 More options Jun 3, 12:12 am
From: John Hornbeck <hornb...@gmail.com>
Date: Tue, 2 Jun 2009 23:12:29 -0500
Local: Wed, Jun 3 2009 12:12 am
Subject: Re: [tulsa.rb] Re: CascadingRubies

I'm not following what you mean by internal vs. external dsl.  Do explain

On Tue, Jun 2, 2009 at 11:08 PM, Joseph A Holsten
<jos...@josephholsten.com>wrote:

--
John Hornbeck
Support Manager
Engine Yard
http://engineyard.com

“Work hard to find something that fascinates you.” - Richard Feynman


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Richter  
View profile  
 More options Jun 3, 12:21 am
From: Justin Richter <jrich...@jetfive.com>
Date: Tue, 2 Jun 2009 23:21:40 -0500
Local: Wed, Jun 3 2009 12:21 am
Subject: Re: [tulsa.rb] Re: CascadingRubies

:)

On Tue, Jun 2, 2009 at 11:08 PM, Joseph A Holsten
<jos...@josephholsten.com>wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Richter  
View profile  
 More options Jun 3, 12:23 am
From: Justin Richter <jrich...@jetfive.com>
Date: Tue, 2 Jun 2009 23:23:19 -0500
Local: Wed, Jun 3 2009 12:23 am
Subject: Re: [tulsa.rb] Re: CascadingRubies

I too like the simplicity, it seems easily hackable.

On Tue, Jun 2, 2009 at 11:21 PM, Justin Richter <jrich...@jetfive.com>wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joseph A Holsten  
View profile  
 More options Jun 3, 1:06 am
From: Joseph A Holsten <jos...@josephholsten.com>
Date: Wed, 3 Jun 2009 00:06:50 -0500
Local: Wed, Jun 3 2009 1:06 am
Subject: Re: [tulsa.rb] Re: CascadingRubies
Fowler has the canonical definitions: http://martinfowler.com/bliki/DomainSpecificLanguage.html

Internal dsls implement domain specific features entirely within a  
host language. Think of them more like code than data. They're a bit  
like tricked out libraries. They use the host language to parse the  
dsl. They're quite popular in with TCL, lisp and ruby. examples:  
markaby, rails (esp migrations), rake, emacs lisp, guile, macports  
portfiles, .exrc, .shrc.

External dsls require a custom parser. Think of them more like data  
than code. They're popular with unix, .net, java. examples: Ant, /etc/
passwd, csv, vcard, yaml configs, xml configs. Arguably every markup  
language lies in here.

On Jun 2, 2009, at 11:12 PM, John Hornbeck wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Hornbeck  
View profile  
 More options Jun 3, 1:10 am
From: John Hornbeck <hornb...@gmail.com>
Date: Wed, 3 Jun 2009 00:10:55 -0500
Local: Wed, Jun 3 2009 1:10 am
Subject: Re: [tulsa.rb] CascadingRubies
Ahh, makes sense now :-)

On Wednesday, June 3, 2009, Joseph A Holsten <jos...@josephholsten.com> wrote:

--
John Hornbeck
Support Manager
Engine Yard
http://engineyard.com

“Work hard to find something that fascinates you.” - Richard Feynman


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Morgan  
View profile  
 More options Jun 3, 10:04 am
From: Tim Morgan <t...@timmorgan.org>
Date: Wed, 3 Jun 2009 09:04:08 -0500
Local: Wed, Jun 3 2009 10:04 am
Subject: Re: [tulsa.rb] Re: CascadingRubies
Thanks Joseph for that wonderful explanation. Yes, this library is a
bonefied DSL, meaning the code is actual Ruby. Sass, on the other
hand, is interpreted as it's own language. With the DSL approach, I'm
able to mix in regular Ruby variables, require Ruby libraries, do
color arithmetic, heck I could even pull CSS colors and font sizes out
of my database and write them directly in my CSS file.

As for why I did it... because I can. Isn't that the best reason of
all? :-) No really, it was just an experiment, and turned out to be
less than 100 lines of code. And I figure it might be useful as a part
of OneBody or another project someday.

Thanks for your feedback!


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Morgan  
View profile  
 More options Jun 3, 10:11 am
From: Tim Morgan <t...@timmorgan.org>
Date: Wed, 3 Jun 2009 09:11:42 -0500
Local: Wed, Jun 3 2009 10:11 am
Subject: Re: [tulsa.rb] Re: CascadingRubies
Let me clarify: CascadingRubies is an internal Ruby DSL -- not an
external interpreted one like Sass. Cuz I said that kinda funny.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tanner Burson  
View profile  
 More options Jun 3, 10:37 am
From: Tanner Burson <tanner.bur...@gmail.com>
Date: Wed, 3 Jun 2009 09:37:00 -0500
Subject: Re: [tulsa.rb] Re: CascadingRubies

Personally I dislike all the crazy CSS DSLs, and I actually tend to use some
simple ERB templates to generate CSS instead of a full blown CSS DSL.  But o
stand up in defense of SASS.

The advantage to an external DSL is that you don't HAVE to know a lot of
details about the hosting language to be able ti use the DSL.  While Tim's
code is pretty slick, it suffers from a few issues, some easy to fix, others
not.

The first being because you don't inherit from a BlankSlate (or similar)
base class, any method available on the Object class cannot be used as a
selector name without using the s() method.  Try using the name 'id' as a
selector.  As mentioned this is somewhat easier to fix by using BlankSlate
or something similar to undefine all the default methods.

The second is that you can't use any ruby keywords as selectors.  As long as
you use instance_eval to run the raw code without doing any sort of parsing
this will remain true.

Obviously those aren't a big deal if you know Ruby, and are aware of the
limitations.  But it does come with it's own set of "gotchas" that an
external DSL doesn't have to worry about.

All of that said, I've already forked this and look forward to tinkering
with it!

--Tanner Burson

--
===Tanner Burson===
tanner.bur...@gmail.com
http://www.tannerburson.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Morgan  
View profile  
 More options Jun 4, 1:03 am
From: Tim Morgan <t...@timmorgan.org>
Date: Thu, 4 Jun 2009 00:03:25 -0500
Local: Thurs, Jun 4 2009 1:03 am
Subject: Re: [tulsa.rb] Re: CascadingRubies
OK, I just released 0.2.0 of my gem. This version addresses a few of
the shortcomings the library had with version 0.1.0.

* Use of BlankSlate and other tricks to clean up the instance_eval
space and avoid
stepping on potential selectors and rules.
* Easily generate comma-separated selectors via the DSL.
* New optional block syntax for rcss files.

Thanks so much for your valuable feedback everyone.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joseph A Holsten  
View profile  
 More options Jun 5, 2:33 am
From: Joseph A Holsten <jos...@josephholsten.com>
Date: Fri, 5 Jun 2009 01:33:07 -0500
Local: Fri, Jun 5 2009 2:33 am
Subject: Re: [tulsa.rb] Re: CascadingRubies
That's a great point, and I'm sure there's a bunch of other standard  
internal DSL issues that I don't even know to check for. I'm kinda  
amazed there isn't a 'Building DSLs in Ruby' book.
has anyone gone through this:
        http://obiefernandez.com/presentations/obie_fernandez-agile_dsl_devel...
Seems like cascading rubies is a straightforward instatiation dsl, but  
there's some other nifty examples in there too. I also learned some  
tricks from:
        http://www.scribd.com/doc/12709855/Advanced-DSLs-in-Ruby
esp, const factories, instance_eval'ing, the fuzzy line between  
internal & external. Neal ford seems to have quite a few good presos  
on dsls if you need some google fu.

On Jun 3, 2009, at 9:37 AM, Tanner Burson wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tanner Burson  
View profile  
 More options Jun 5, 10:26 am
From: Tanner Burson <tanner.bur...@gmail.com>
Date: Fri, 5 Jun 2009 09:26:15 -0500
Local: Fri, Jun 5 2009 10:26 am
Subject: Re: [tulsa.rb] Re: CascadingRubies

Great resources Joseph, thanks!

On Fri, Jun 5, 2009 at 1:33 AM, Joseph A Holsten
<jos...@josephholsten.com>wrote:

--
===Tanner Burson===
tanner.bur...@gmail.com
http://www.tannerburson.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Building DSLs (was CascadingRubies)" by Joseph A Holsten
Joseph A Holsten  
View profile  
 More options Jun 5, 7:46 pm
From: Joseph A Holsten <jos...@josephholsten.com>
Date: Fri, 5 Jun 2009 18:46:05 -0500
Local: Fri, Jun 5 2009 7:46 pm
Subject: [tulsa.rb] Re: Building DSLs (was CascadingRubies)
I forgot about a book I've been interested in, “Building Domain  
Specific Languages in Boo,” by Ayende Rahien[1]. That's the guy who  
wrote RhinoMock for c#. (If you've got to use .NET, you absolutely  
need to know LINQ and RhinoMock to know the furthest edge of the  
possible in the language.)

Do any of the local user groups have a relationship with Manning to  
get a copy?

1: http://www.manning.com/rahien/

On Jun 5, 2009, at 9:26 AM, Tanner Burson wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google