gruntjs / grunt-contrib-connect

Start a static web server.
http://gruntjs.com
MIT License
714 stars 146 forks source link

Nagivate to specific URL on open #153

Closed duncanmapes closed 9 years ago

duncanmapes commented 9 years ago

this is working really well...my site is launching with exactly the base i need and everything is great.

my only issue/question is....is it possible to launch to a url that isn't the site root? right now my site launches to http://localhost:9000/ no matter what, but if i want it to launch to http://localhost:9000/siteA without changing the base at all, how would i do that? or is it not possible?

Athaphian commented 9 years ago

Not sure if this is the most optimal solution, but I do this by setting custom middleware. I have more middleware configuration, just extracted the part you probably need. Maybe its useful.

middleware: function (connect, options) { var middlewares = []; middlewares.push(connect.static('./app', {index: 'siteA.html'})); return middlewares; }

duncanmapes commented 9 years ago

so its much easier than that...someone pointed out to me a better solution

...
options: {
  open:{
    target: 'http://localhost:9000/siteA',
    },
...