在Html页面中处理大量外部JS文件的任何好方法?

时间:2015-03-31 17:52:37

标签: javascript

考虑以下

<html ng-app="crudModule">
@{
    ViewBag.Title = "Index";
}

<body ng-controller="crudController">
    <table id="tblContainer" border="1">
        <thead>
            <tr>
                <th>EmpName</th>                
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="emp in Employees" my-employee="emp"></tr>
        </tbody>
    </table>
    <script type="text/ng-template" id="Employee.html">
        <tr>
            <td> <span>{{_employee.EmployeeId}}</span></td>            
        </tr>
    </script>   
</body>
</html>
<script src="~/Scripts/angular.js"></script>
<script src="~/Scripts/angular-route.js"></script>
<script src="~/Scripts/MyScripts/Module.js"></script>
<script src="~/Scripts/MyScripts/Service.js"></script>
<script src="~/Scripts/MyScripts/Controller.js"></script>
<script src="~/Scripts/MyScripts/Builder.js"></script>
<script src="~/Scripts/MyScripts/Utility.js"></script>

同一页面中有很多外部javascript文件。

有没有什么好方法可以让页面只有一个JS文件,而其他文件会在那里或其他任何方式?

1 个答案:

答案 0 :(得分:0)

这是asp.net / mvc使用脚本捆绑。参见

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

由于