Mislav:

The reason for doing this was to keep things DRY. Otherwise the two
stylesheets are identical except for the paths. So if I change one, I
have to remember to change the other... This is something I avoid in
Ruby code, so why not avoid it in SASS? Anyway, if it's not possible
that's okay - I can live with it.

Sean:

Thanks for the suggestion - sounds like it would work but a little too
fiddly for my liking. I think it'll be simpler to just update both
files for now.

On Apr 23, 7:48 am, "Mislav Marohnić" <[EMAIL PROTECTED]>
wrote:
> I don't think Sass will ever process Ruby code. You have to rethink your
> design.
>
> As for your #1: why do you need this? Simply combine separate stylesheets
> with the fact images are looked up relatively to the location of *.css file.
>
> #2 and #3 are already handled by Sass import feature.
>
> And as for theming your site or having users define some styles: you can use
> Sass for that, too. Simply use Sass::Engine directly in your app, but
> interpolate the origin string with as much Ruby as you want. Then convert to
> CSS and render inline in HTML layout or save to a file on disk and then
> include it.
>
> I think we'll be more able to help you once we find out your ultimate goal.
>
> On Tue, Apr 22, 2008 at 11:38 PM, zubin <[EMAIL PROTECTED]> wrote:
>
> > Apologies if this is the wrong place to post SASS questions - I
> > couldn't find a separate SASS forum so here goes...
>
> > Is it possible to insert Ruby code in a SASS file?
>
> > The reason is because I need two separate stylesheets which are almost
> > identical, and I want to keep things DRY (the only difference is the
> > graphics path).
>
> > My initial plan was something like this:
>
> > 1. Create a SASS "template" file (called template.sass) which uses
> > __FILE__ to define graphics path:
>
> >    !template_path = "/images/#{File.basename(__FILE__)}"
> >    #header
> >     :background = "url(" + !template_path + "/bg.jpg)"
>
> > 2. Link required sections to it:
>
> >    ln -s template.sass section1.sass
> >    ln -s template.sass section2.sass
>
> > 3. Link to stylesheet for current section (note: sections are sharing
> > the same layout file):
>
> >    # in application.html.haml
> >    = stylesheet_link_tag @template
>
> > But I got stuck at step 1. Any suggestions? Is there a better way?
>
> > PS - Thank you Hampton, Nathan and Jeff for haml (and sass of course)
> > - brilliant code and documentation! As suggested in the docs, it _has_
> > inspired me to write cleaner code. Nice work! And make_resourceful is
> > awesome too...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to