1

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!

tengen
  • 2,125
  • 3
  • 31
  • 57
  • 1
    strange. did you try open: 'http://localhost:8888/myApp/#/home' this is also a valid configuration. – michael Jan 16 '14 at 20:00
  • @Michael I added grunt-open and was able to get it working. if you phrase your comment as a question I'll accept! Thanks! – tengen Jan 21 '14 at 17:19

0 Answers0