klaus
2009-Dec-12 12:12 UTC
how to print out content of stylesheets in <style> tag via stylesheet_link_tag
Hi! 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? Greetings from Germany Klaus -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Philip Hallstrom
2009-Dec-12 17:19 UTC
Re: how to print out content of stylesheets in <style> tag via stylesheet_link_tag
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
klaus
2009-Dec-12 18:39 UTC
Re: 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-LSG90OXdqQE@public.gmane.org>> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.