[Rails] Re: Dynamic Assets - can it be done?
Frederick Cheung wrote:
> On Jan 15, 3:50 pm, Alpha Blue <li...@ruby-forum.com> wrote:
>> Fred, so the issue with the code above is this:
>>
>> When using such a helper it will display:
>>
>> link href="/stylesheets/public/themes/default/stylesheets/default.css"
>> media="screen" rel="stylesheet" type="text/css"
>
> That sounds like the path you passed didn't have a leading / (and you
> don't want the public in there).
>
> Fred
Fred, as always, you were correct. I removed the monkey patching code
and then I fixed the test helper to:
def current_theme_path(type)
path = "/themes/" + @opt_default_theme + "/images/" if type == 'img'
path = "/themes/" + @opt_default_theme + "/stylesheets/" if type ==
'css'
path = "/themes/" + @opt_default_theme + "/javascripts/" if type ==
'js'
path = "/themes/" + @opt_default_theme + "/swfs/" if type == 'swf'
return path
end
...
And finally in my layout:
<%= stylesheet_link_tag(current_theme_path('css')+ @opt_theme +'.css')
%>
<%= javascript_include_tag(current_theme_path('js')+ @opt_theme +'.js')
%>
.. and it works.
I'll work with this bit of code instead and see how it affects asset
caching.
--
Posted via http://www.ruby-forum.com/.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home