在 html 中:
<script type="text/javascript" src="/layout/load_scripts?jquery.validate.min.js,jquery-1.5.1.min.js,jquery-ui-1.8.11.min.js,jquery.unobtrusive-ajax.min.js,jquery.validate.unobtrusive.min.js"></script>
在服务器上:
load_scripts: function (context) {
var combined_script = '';
var script_names = context.parameters.split(',');
for (var i = 0; i < script_names.length; i++) {
combined_script += fs.readFileSync('./content/scripts/global/' + script_names[i]);
}
context.response.writeHead(200, { 'Content-Type': 'application/javascript' });
context.response.end(combined_script);
}
但是脚本没有加载。请帮忙