Saturday, December 12, 2009

Re: [Rails] how to print out content of stylesheets in <style> tag via stylesheet_link_tag

For normal stylesheet link tags works fine in facebook. In our production environment this is no problem. Also it wasn't a problem for a long time from my development-system.
But when i started to include kontagent the whole thing slows really down.

Thanks for your approach - I hoped that there is an easier way out there :)


2009/12/12 Philip Hallstrom <philip@pjkh.com>
> I'm developing facebook apps with ruby on rails. My connection is
> really
> slow. The stylesheets do not load mosts of the time.
> So i want to print out the content of my .css-files in <style> Tags.
> Is this
> possibe with some parameter to the stylesheet_link_tag or an other
> tag?

My understanding is that stylesheet link tags *never* work in Facebook
canvas apps.  You have to include them inline.

I don't think there is a built in way to do it, but you could use
stylesheet_path in conjunction with RAILS_ROOT and File.read to write
a little helper method to do it.

Something like...

def inline_stylesheet(source)
  "<style type='text/css'>" +
  File.read("#{RAILS_ROOT}#{stylesheet_path(source)}") +
  "</style>"
end

--

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



--

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate