简体   繁体   中英

Load Multiple Javascript Files into One Javascript File in ASP.NET C#

Load multiple Javascript files in one javascript file in asp.net c#. I don't want to merge all into one file. i want to load all js files into one js file. So , I can use only one JS file in my other ASPX pages.

**FOR EXAMPLE**,
My javascript File - File1.JS<br/>
and I want to load Other JS files (File2.JS,File3.JS,etc.)

"File2.JS" Contains:
<br/><b>function Test() { alert('here'); }</b>

"File1.JS" Contains :<b>
<br/>"../File2.JS"
<br/>"../File3.JS"

"ASPX Page":
<br/>**<script src="Scripts/File1.JS" type="text/javascript"></script> in ASPX Page**
<br/>
<br/>**Below Javascript Code:**
<script type="text/javascript">
$(document).ready(function () {
Test();
});
</script>
This is my requirements.
Please give me a solution on this.

Did you heard about bundling in asp.net? This might be helpful for you. You can get more idea from the link given below

http://www.asp.net/mvc/overview/performance/bundling-and-minification

or

https://www.sitepoint.com/bundling-asp-net/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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