Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Produce a "type" attribute in the "script" tag when using Scripts.Render in ASP.NET MVC 4

Is it possible to configure Scripts.Render in ASP.NET MVC 4 to produce a "type" attribute in the "script" tag?

If so, how?

Thanks in advance,

Ryan

like image 743
Ryan Penfold Avatar asked Oct 24 '12 14:10

Ryan Penfold


1 Answers

The 1.1-alpha1 update has support doing your own tag formatting with the Scripts/Styles helpers.

There's a new DefaultTagFormat property which is by default set to:

"<script src="{0}"></script>"

There's also a RenderFormat method which takes in the tag format as well. You should be able to add the type attribute via either of these two mechanicsms.

like image 84
Hao Kung Avatar answered Oct 15 '22 09:10

Hao Kung