Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
168
rated 0 times [  172] [ 4]  / answers: 1 / hits: 18901  / 11 Years ago, wed, may 29, 2013, 12:00:00

I have looked through Google and Stackoverflow and haven't found an answer for this. Is there any built in way to make a bundle execute as deffered or does someone know of an extension helper method that someone wrote to do this?


More From » asp.net

 Answers
10

Try upgrading the Web Optimization to version 1.1.0 on
Codeplex Site or via Nuget Package



In version 1.1.0 they included Element Template Strings.
So if you want a script tag to contains the defer attribute you can easily do this:



@Scripts.RenderFormat(<script src='{0}' defer></script>,~/bundles/jquery)


and the following markup will be generated:



<script src=/Scripts/jquery-1.7.1.js defer></script> 

[#77931] Wednesday, May 29, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pranav

Total Points: 693
Total Questions: 119
Total Answers: 119

Location: Greenland
Member since Fri, Jul 31, 2020
4 Years ago
pranav questions
Thu, Feb 10, 22, 00:00, 2 Years ago
Tue, Dec 28, 21, 00:00, 2 Years ago
Mon, Sep 6, 21, 00:00, 3 Years ago
Mon, Mar 8, 21, 00:00, 3 Years ago
;