hiddentao / gulp-server-livereload

Gulp plugin to run a local webserver with livereload enabled via socket.io. Also comes with standalone command-line interface.
MIT License
93 stars 28 forks source link

defaultFile not setting path #9

Open aciccarello opened 9 years ago

aciccarello commented 9 years ago

I have a gulp task in which I'm trying to automatically open a file in the app directory of my project from the root. However, the browser simply opens localhost:8000 displaying the index.html file. Because the browser url is not set to contain the app directory, the included CSS and JS files are not loaded.

Task:

gulp.task('start', start);
/** Start app with the live reload server */
function start() {
  gulp.src(paths.root)
    .pipe(server({
      livereload: false,
      defaultFile: '/app/index.html',
      open: true
    }));
};

It appears that the server serves the default file when a request is made for the root of the server (localhost:8000). I would like to be able to have the browser load One solution I can think of is a defaultPath option which would open the browser to something other than the root.

Note: The reason I'm not starting the webserver on the app directory is because I have other directories of the project which I want access to (such as docs/ ).

hiddentao commented 9 years ago

Not a bad idea. PR welcome.