Re: [haml] Re: Exponential

2011-04-24 Thread Chris Eppstein
I suspect that you're code is not being required at all because the code you
pasted isn't going to work and the behavior you're seeing is as if it's not
present. The code should be:

def exp(value, power)
 Sass::Script::Number.new(value.value**power.value)
end

chris

On Sun, Apr 24, 2011 at 11:32 AM, davidyeiser
da...@designintellection.comwrote:

 Ah, gotcha. Thanks.

 This is what I added to the functions.rb file:

 def exp(value, power)
  Sass::Script::Number.new(value**power)
 end

 (I added it beneath the def abs(value) function.)

 However, when I use it in my .scss file and then output it to .css it
 doesn't execute.

 For example:

 style.scss
 --
 font-size: exp(2px, 3);

 Outputs to:

 style.css
 -
 font-size: exp(2px, 3);

 The other functions execute fine, and the command line output gives no
 error. (I'm using sass --watch style.scss:style.css --style compact)

 Any idea on what I'm doing wrong?

 P.S. It's probably obvious that I've never programmed in Ruby before,
 and if this mailing list isn't supposed to be used for n00b support
 just let me know. Thanks!

 On Apr 24, 10:39 am, Chris Eppstein ch...@eppsteins.net wrote:
  You're not missing it. There's no syntax or function for this. You can
 add a custom function to sass to implement this in ruby.
 
  Chris
 
  Hunt  pecked on my iPhone... Sorry if it's brief!
 
  On Apr 23, 2011, at 10:29 PM, davidyeiser da...@designintellection.com
 wrote:
 
 
 
   Forgive me if I'm missing something obvious, but is there a default
   way for SASS to execute exponential operators?
 
   So, for example: 2 ^ 3 = 8
 
   Thank you!
 
   --
   You received this message because you are subscribed to the Google
 Groups Haml group.
   To post to this group, send email to haml@googlegroups.com.
   To unsubscribe from this group, send email to
 haml+unsubscr...@googlegroups.com.
   For more options, visit this group athttp://
 groups.google.com/group/haml?hl=en.

 --
 You received this message because you are subscribed to the Google Groups
 Haml group.
 To post to this group, send email to haml@googlegroups.com.
 To unsubscribe from this group, send email to
 haml+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/haml?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Haml group.
To post to this group, send email to haml@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.



Re: [haml] Re: Exponential

2011-04-24 Thread Victor Costan
Any chance you're doing this under Rails? If so, you'll need to
restart your server to pick up changes in gems and libraries. They're
not auto-loaded.

I hope this helps,
    Victor


On Sun, Apr 24, 2011 at 11:23 PM, davidyeiser
da...@designintellection.com wrote:
 Yes, you are correct. I tried changing the spelling of one of the
 other functions and it still executed it fine. (I changed def
 abs(value) to def absl(value). Nothing happened.)

 I'm experimenting with all this on Mac OS X 10.6.6. The Ruby version
 is 1.8.7.

 The file where I am trying to add the custom function is:

 /usr/lib/ruby/user-gems/1.8/gems/haml-3.0.25/lib/sass/script/
 functions.rb

 Is this the wrong file?

 On Apr 24, 4:25 pm, Chris Eppstein ch...@eppsteins.net wrote:
 I suspect that you're code is not being required at all because the code you
 pasted isn't going to work and the behavior you're seeing is as if it's not
 present. The code should be:

 def exp(value, power)
  Sass::Script::Number.new(value.value**power.value)
 end

 chris

 On Sun, Apr 24, 2011 at 11:32 AM, davidyeiser
 da...@designintellection.comwrote:



  Ah, gotcha. Thanks.

  This is what I added to the functions.rb file:

  def exp(value, power)
   Sass::Script::Number.new(value**power)
  end

  (I added it beneath the def abs(value) function.)

  However, when I use it in my .scss file and then output it to .css it
  doesn't execute.

  For example:

  style.scss
  --
  font-size: exp(2px, 3);

  Outputs to:

  style.css
  -
  font-size: exp(2px, 3);

  The other functions execute fine, and the command line output gives no
  error. (I'm using sass --watch style.scss:style.css --style compact)

  Any idea on what I'm doing wrong?

  P.S. It's probably obvious that I've never programmed in Ruby before,
  and if this mailing list isn't supposed to be used for n00b support
  just let me know. Thanks!

  On Apr 24, 10:39 am, Chris Eppstein ch...@eppsteins.net wrote:
   You're not missing it. There's no syntax or function for this. You can
  add a custom function to sass to implement this in ruby.

   Chris

   Hunt  pecked on my iPhone... Sorry if it's brief!

   On Apr 23, 2011, at 10:29 PM, davidyeiser da...@designintellection.com
  wrote:

Forgive me if I'm missing something obvious, but is there a default
way for SASS to execute exponential operators?

So, for example: 2 ^ 3 = 8

Thank you!

--
You received this message because you are subscribed to the Google
  Groups Haml group.
To post to this group, send email to haml@googlegroups.com.
To unsubscribe from this group, send email to
  haml+unsubscr...@googlegroups.com.
For more options, visit this group athttp://
  groups.google.com/group/haml?hl=en.

  --
  You received this message because you are subscribed to the Google Groups
  Haml group.
  To post to this group, send email to haml@googlegroups.com.
  To unsubscribe from this group, send email to
  haml+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/haml?hl=en.

 --
 You received this message because you are subscribed to the Google Groups 
 Haml group.
 To post to this group, send email to haml@googlegroups.com.
 To unsubscribe from this group, send email to 
 haml+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/haml?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Haml group.
To post to this group, send email to haml@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.



Re: [haml] Re: Exponential

2011-04-24 Thread Chris Eppstein
Please don't modify the gem installation files, that is a sure way to lose
your changes. If you're using sass on the command line make a file called
sass_extensions.rb and add the following:

module Sass::Script::Functions
  def exp(value, power)
Sass::Script::Number.new(value.value**power.value)
  end
end

Then compile your stylesheets like this:

sass -r sass_extensions foo.sass:foo.scss

chris

On Sun, Apr 24, 2011 at 8:23 PM, davidyeiser
da...@designintellection.comwrote:

 Yes, you are correct. I tried changing the spelling of one of the
 other functions and it still executed it fine. (I changed def
 abs(value) to def absl(value). Nothing happened.)

 I'm experimenting with all this on Mac OS X 10.6.6. The Ruby version
 is 1.8.7.

 The file where I am trying to add the custom function is:

 /usr/lib/ruby/user-gems/1.8/gems/haml-3.0.25/lib/sass/script/
 functions.rb

 Is this the wrong file?

 On Apr 24, 4:25 pm, Chris Eppstein ch...@eppsteins.net wrote:
  I suspect that you're code is not being required at all because the code
 you
  pasted isn't going to work and the behavior you're seeing is as if it's
 not
  present. The code should be:
 
  def exp(value, power)
   Sass::Script::Number.new(value.value**power.value)
  end
 
  chris
 
  On Sun, Apr 24, 2011 at 11:32 AM, davidyeiser
  da...@designintellection.comwrote:
 
 
 
   Ah, gotcha. Thanks.
 
   This is what I added to the functions.rb file:
 
   def exp(value, power)
Sass::Script::Number.new(value**power)
   end
 
   (I added it beneath the def abs(value) function.)
 
   However, when I use it in my .scss file and then output it to .css it
   doesn't execute.
 
   For example:
 
   style.scss
   --
   font-size: exp(2px, 3);
 
   Outputs to:
 
   style.css
   -
   font-size: exp(2px, 3);
 
   The other functions execute fine, and the command line output gives no
   error. (I'm using sass --watch style.scss:style.css --style compact)
 
   Any idea on what I'm doing wrong?
 
   P.S. It's probably obvious that I've never programmed in Ruby before,
   and if this mailing list isn't supposed to be used for n00b support
   just let me know. Thanks!
 
   On Apr 24, 10:39 am, Chris Eppstein ch...@eppsteins.net wrote:
You're not missing it. There's no syntax or function for this. You
 can
   add a custom function to sass to implement this in ruby.
 
Chris
 
Hunt  pecked on my iPhone... Sorry if it's brief!
 
On Apr 23, 2011, at 10:29 PM, davidyeiser 
 da...@designintellection.com
   wrote:
 
 Forgive me if I'm missing something obvious, but is there a default
 way for SASS to execute exponential operators?
 
 So, for example: 2 ^ 3 = 8
 
 Thank you!
 
 --
 You received this message because you are subscribed to the Google
   Groups Haml group.
 To post to this group, send email to haml@googlegroups.com.
 To unsubscribe from this group, send email to
   haml+unsubscr...@googlegroups.com.
 For more options, visit this group athttp://
   groups.google.com/group/haml?hl=en.
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Haml group.
   To post to this group, send email to haml@googlegroups.com.
   To unsubscribe from this group, send email to
   haml+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/haml?hl=en.

 --
 You received this message because you are subscribed to the Google Groups
 Haml group.
 To post to this group, send email to haml@googlegroups.com.
 To unsubscribe from this group, send email to
 haml+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/haml?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Haml group.
To post to this group, send email to haml@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.