Rename project root 'www' to 'app'


#1

Is it possible to rename the project app folder ‘www’ to something else, like ‘app’?

I tried editing the ionic.project file and added the watchPatterns property, but nevertheless the ionic serve command tells it cannot find /foo/bar/www/index.html.
I’ve got a quite big existing project build with angular and some other ui framework and want to exchange the ui with ionic.


#2

Just add documentRoot in your ionic.project file:

{
  "name": "myApp",
  "app_id": "",
  "documentRoot": "app",
  "gulpStartupTasks": [
    "sass",
    "watch"
  ],
  "watchPatterns": [
    "app/**/*",
    "!app/lib/**/*"
  ]
}

If you check in the folder npm\node_modules\ionic\node_modules\ionic-app-lib\lib you will find a file called serve.js.

At some point in the code you will find something like this:

options.documentRoot = project.get('documentRoot') || 'www';

That’s the place where I have found how to do it.


#3

Awesome! Thanks a lot!
Why isn’t this documented anywhere anyway… -.-


#4

It is actually documented. You can find it here.