I am trying to get my grunt connect task working correctly, and I'm stumped. I have an angular app that I want to run, and it sits in a folder like this:
dev/myApp
|--- /modules
|--- /directives
|--- /vendor
|--- /etc...
|--- index.html
I am using ui-router to manage state and routing in my app, starting with a default state like this:
myApp.config(['$stateProvider', function ($stateProvider) {
$stateProvider
.state('home', {
url: "/home",
views: {
...
I want to do something very simple: use grunt's connect task runner to open a browser and navigate to http://localhost:8888/myApp/#/home
.
I am using the connect task list so:
connect: {
options: {
base: 'dev/'
},
devserver: {
options: {
port: 8888,
open: {
target: 'http://localhost:8888/myApp/#/home'
}
}
}
}
The grunt connect documentation seems pretty clear, yet my window always opens to plain-old localhost:8888
. If I manually type in the URL I want, it works fine.
I've tried looking for examples online, but most tutorials I have seen are explaining the middleware option, which I don't believe I need for something this simple. What am I missing?
Thanks in advance!
Update:
Per @Michael's suggestion, I used grunt-open, with the following config in my gruntfile:
open: {
devserver: {
path: 'http://localhost:8888/myApp/#/home'
}
}
This now works great.
Thanks!