简体   繁体   English

在asp.net中合并javascript文件

[英]combining javascript files in asp.net

I have several javascript files and I'd like to combine them into one file but only when the page is rendered, and still keep my files separate because it's easier to code with multiple files than one giant one. 我有几个javascript文件,但我想将它们合并到一个文件中,但仅在页面呈现时才能使用,并且仍将我的文件分开,因为与多个文件相比,使用多个文件进行编码更容易。

How do I do this? 我该怎么做呢? I saw some tutorials on how to do it but they're dated. 我看到了一些有关如何执行此操作的教程,但它们已过时。 I'm using VS 2012 and I was wondering if there's a newer way. 我正在使用VS 2012,我想知道是否有更新的方法。

Thanks. 谢谢。

既然您提到VS2012,请检查捆绑和缩小

Use ScriptManager's thingy called "CompositeScript". 使用ScriptManager的“ CompositeScript”。 Probably the easiest way to do this. 可能是最简单的方法。

http://msdn.microsoft.com/en-us/library/cc488552(v=vs.90).aspx http://msdn.microsoft.com/zh-CN/library/cc488552(v=vs.90).aspx

You can always implement your custom solution though, if this doesn't fit your needs for whatever reason. 如果由于某种原因这不能满足您的需求,您始终可以实施自定义解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM