lucasefe / themes_for_rails

Theme Support for Rails 3
This very same page :)
MIT License
308 stars 102 forks source link

theme_javascript_include_tag produces type="text/plain" #34

Closed heygambo closed 12 years ago

heygambo commented 13 years ago

Somehow when using "theme_javascript_include_tag" in my project "" will be generated. I need the type attribute to be "text/javascript" otherwise some browsers may not interprete the JavaScript.

Is there a solution to this problem?

Greets, Gambo

heygambo commented 13 years ago

I've tried to use

<%= javascript_include_tag "/themes/default/javascripts/jquery.jcarousel.min.js" #(not theme_javascript_include_tag)  %>

which produces "text/plain" as well.

So I've added the attribute :type => "text/javascript":

<%= javascript_include_tag "/themes/default/javascripts/jquery.jcarousel.min.js", :type => "text/javascript" %>

that works fine. So you may consider to explicitly set this attribute.

I didn't test this Code but you may give it a try?

def theme_javascript_include_tag(*files)
  files.collect! {|file| theme_javascript_path(file) }
  javascript_include_tag *files, :type => "text/javascript"
end

instead of

def theme_javascript_include_tag(*files)
  files.collect! {|file| theme_javascript_path(file) }
  javascript_include_tag *files
end
lucasefe commented 12 years ago

Since this is an old issue, I would like to know if this problem is still current. Is this happening still?

i don't like adding stuff that seems redundant, that's why I am asking you...

Sorry for the delay.. I know it's been a long time.

JediFreeman commented 12 years ago

This actually got resolved in v0.5.0.pre as we now explicitly add the "text/javascript" or "text/css" type to the options hash in theme_javascript_include_tag and theme_stylesheet_link_tag.

Keep in mind, you can still override this by passing :type => "foo" into those calls explicitly.