title: Trigger the bundle inclusion from partial or editor templates in ASP.NET MVC 4
body: <p>I'm building a framework on top of ASP.NET MVC 4. I like the new bundling feature in MVC4 but I'm running into an issue and I'm not sure if the new bundling features address this scenario.</p>
  
  <p>My layout view is rendering it's script bundles at the bottom of the page before <code>&lt;/body&gt;</code>.</p>
  
  <p>Since my project is a framework, the view doesn't know all of the bundles that the page will need. My project is making heavy use of editor templates, which may need to include some javascript, but can't render it in the editor template itself because:</p>
  
  <ul>
  <li>The script needs to be included only once and the editor template may be rendered more than once.</li>
  <li>The script may depend on other javascript libraries like jQuery, which haven't been included yet (they are rendered at the bottom of the page).</li>
  </ul>
  
  <p>So, what I'd like to do is something like this in an editor template:</p>
  
  <pre><code>@Scripts.TriggerInclusion("~/path/to/bundle/that/this/editor/needs")
  </code></pre>
  
  <p>And that would cause the bundle script tag to be rendered towards the end of the page only once.</p>
  
  <p>I could go to the trouble of building this into my project's infrastructure, but I'm hoping that this sort of thing is already supported somehow. Thanks!</p>