使用grunt-contrib-connect - 带添加上下文路径的打开页面URL [英] Using grunt-contrib-connect - open page URL with added context path
问题描述
connect:{
options:{
端口:9000,
livereload:35729,
主机名:'localhost'
},
livereload:{
选项:{
open:true,
base:[
'app'
]
}
}
}
这很好 - 将我的index.html页面加载为:
http: // localhost:9000
然而,为了保持它与生产中的加载一致,希望它加载额外的上下文路径,如:
http:// localhost:9000 / myappcontext / secured
这可以通过grunt-contrib-connect简单完成吗?或者我需要添加一些其他代理/中间件?
任何人都有这种设置的简单例子吗?
是的,您可以毫不费力地做到这一点,只需配置打开
选项即可:
connect:{
options:{
port:9000,
livereload:35729,
hostname:'localhost'
},
livereload:{
options:{
open:{
target:'http:// localhost:9000 / myappcontext / secured'
},
base:[
'app'
]
}
}
}
I have set up grunt connect like this:
connect: {
options: {
port: 9000,
livereload: 35729,
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'app'
]
}
}
}
That works great - loads my index.html page as:
http://localhost:9000
However, to keep this consistent with how it will be loaded in production, I would like it to load it with additional context path added, like:
http://localhost:9000/myappcontext/secured
Can this be done simply with grunt-contrib-connect? Or do I need to add some other proxy/middleware?
Anyone got a simple example of this type of set-up?
Yes you can do this without much trouble, just configure the open
option:
connect: {
options: {
port: 9000,
livereload: 35729,
hostname: 'localhost'
},
livereload: {
options: {
open: {
target: 'http://localhost:9000/myappcontext/secured'
},
base: [
'app'
]
}
}
}
You can consult the README for more information about the available options.
这篇关于使用grunt-contrib-connect - 带添加上下文路径的打开页面URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!