How do I add type=“text/javascript” to a script tag when using System.Web.Optimization

后端 未结 2 1263
隐瞒了意图╮
隐瞒了意图╮ 2020-12-17 22:17

I have the following

bundles.Add(new ScriptBundle(\"~/bundles/scripts/common\").Include(
                  \"~/Scripts/jquery.validationEngine.js\",
                


        
2条回答
  •  我在风中等你
    2020-12-17 22:38

    One way is to change how you render your scripts:

    From:

    @Scripts.Render("~/bundles/scripts/common")
    

    To:

    
    

    Or depending on how you are implementing bundling, you may need:

    
    

    Or for web forms:

    
    

    Although if there is a way to do it using @Script.Render I'd like to see it.

    UPDATE: in response to your comments, as specified in this SO answer, in the pre-release version of System.Web.Optimization, there is an option called RenderFormat that will let you do this as well... but I think the stuff above is easier to read for this particular case.

提交回复
热议问题