在grunt文件中,livereload块看起来像这样:
livereload: {
options: {
open: true,
middleware: function(connect, options, middleware) {
var optBase = (typeof options.base === 'string') ? [options.base] : options.base;
return [
[require('connect-modrewrite')(['!(\\..+)$ / [L]'])].concat(
optBase.map(function(path) {
return connect.static(path);
})),
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect().use(
'/app/styles',
connect.static('./app/styles')
),
connect.static(appConfig.app)
];
}
}
},
Run Code Online (Sandbox Code Playgroud)
添加:
[require('connect-modrewrite')(['!(\\..+)$ / [L]'])].concat(
optBase.map(function(path){ return connect.static(path); })),
Run Code Online (Sandbox Code Playgroud)
确实用来为我工作启用html5模式,否则,我的路由不加载#!当我尝试通过浏览器重新加载时.
我确实在config中添加了基础href ='/'和html5Mode(true).还有什么我可以尝试的吗?为什么它真的会停止工作?
注意:事实证明我的URL中有一个点,并且connect-mod重写规则没有这样做.知道如何更改它并使其能够处理URL中的点?
我使用基于ubuntu的集成文档服务器4.4.3,下面的代码是为我的适用性定制的,我如何根据键形成一个url
asc_docs_api.prototype.asc_customCallback = function(typeFile, bIsDownloadEvent)
{
var actionType = c_oAscAsyncAction.DownloadAs;
var options = {downloadType : DownloadType.Download };
this._downloadAs("save", typeFile, actionType, options, function(incomeObject){
if (null != incomeObject && "save" == incomeObject["type"]) {
//incomeObject["data"] will return key of the document instead of key, i need full url of the document with md5 and expires like below
//ex: http://cache/files/.....
});
};
Run Code Online (Sandbox Code Playgroud)
先感谢您