Thanks a bunch.
I've created:
/lib/sass_script_functions.rb
with the sample code.
That works great. However, I'm not clear on the "Rails way" to bring
my data into scope in the module. For example, how would I bring
@user into scope in the following example?
module Sass::Script::Functions
def reverse(string)
assert_type string, :String
Sass::Script::String.new(string.value.reverse)
end
def favorite_color()
Sass::Script::String.new(@user.favorite_color)
end
end
On Oct 8, 11:05 am, Nathan Weizenbaum <
nex...@gmail.com> wrote:
> The best way to pass data into Sass is using user-defined Sass functions.
> Seehttp://
sass-lang.com/docs/yardoc/Sass/Script/Functions.html#adding_cu...
> details.
>
> If you're doing this, you'll want to make sure that your stylesheets get
> regenerated whenever the data changes. You can do so by calling
> Sass::Plugin.force_update_stylesheets.
>
>
>
> On Fri, Oct 8, 2010 at 8:38 AM, Robert Head <
robert.h...@gmail.com> wrote:
> > I'm working on a Rails 2.3.8 project where I want to assign the SASS
> > variables to rarely-changing, but user-editable data.
>
> > I've tried a couple of different scenarios with generating sass with
> > controller actions and show.sass.erb views. Only partial success. So
> > far, there are too many layers of abstraction for me to decipher where
> > I'm going wrong and I'm looking for the collective wisdom here.
>
> > In short, how should I approach inserting ruby data into a sass file,
> > preferrably a sass partial, in Rails?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Sass" group.
> > To post to this group, send email to
sass...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
sass-lang+...@googlegroups.com<sass-lang%2Bunsubscribe@googlegroups .com>
> > .