[haml] Pass a string to Haml::Exec::SassConvert ?

2010-08-03 Thread Charles Roper
Hi, Is it possible to pass a string to SassConvert? I can do something like this: require 'rubygems' require 'haml/exec' STDIN = ENV['TM_SELECTED_TEXT'] opts = Haml::Exec::SassConvert.new(%w{--from sass --to scss --stdin}) opts.parse! But that gives me a warning about STDIN already being

Re: [haml] Pass a string to Haml::Exec::SassConvert ?

2010-08-03 Thread Chris Eppstein
Silly rubyist, some things are better done with shell :P Try this for your command body: echo $TM_SELECTED_TEXT | sass-convert --from sass --to scss Chris On Tue, Aug 3, 2010 at 4:25 PM, Charles Roper reac...@charlesroper.co.ukwrote: Hi, Is it possible to pass a string to SassConvert? I

Re: [haml] Pass a string to Haml::Exec::SassConvert ?

2010-08-03 Thread Charles Roper
Ah, yes, that works with a decent shell, like bash, but it doesn't work in the stinkin' Windows cmd.exe. This works: #!bash.exe echo $TM_SELECTED_TEXT | sass-convert --from sass --to scss --stdin But that's because I've got bash in my Windows PATH courtesy of MSysGit. I was trying to avoid that

Re: [haml] Pass a string to Haml::Exec::SassConvert ?

2010-08-03 Thread Chris Eppstein
Anyways, you might have some luck creating a StringIO object from the environment value and using that to replace STDIN or $stdin if you care to continue down the ruby-based path. On Tue, Aug 3, 2010 at 4:43 PM, Charles Roper reac...@charlesroper.co.ukwrote: Ah, yes, that works with a decent

Re: [haml] Pass a string to Haml::Exec::SassConvert ?

2010-08-03 Thread Nathan Weizenbaum
Why not just use the Sass APIs directly? Check out the source for sass-convert to see how. It's all pretty straightforward. On Tue, Aug 3, 2010 at 4:25 PM, Charles Roper reac...@charlesroper.co.ukwrote: Hi, Is it possible to pass a string to SassConvert? I can do something like this: