在HTML:服務相結合的JavaScript文件
<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);
}
但劇本不加載。請幫助
Thanks @Pickels我會在回家時執行此操作 – karaxuna 2012-07-19 06:01:40