Search code examples
asp.netasp.net-mvcasp.net-optimizationbundling-and-minification

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


Solution

  • 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.