How to contact root in connect.server ()?

I use gulp -connect, I have all my .html files in the project root directory.

This is my gruntfile.js

var gulp = require('gulp');
var connect = require('gulp-connect');

gulp.task('connect', connect.server({
    root: '/',
    port: 8000,
    livereload: true,
    open: {
        file: 'index.html'
    }
}));

I tried root: '', root: '.'and also did not declare anything, they all did not work with a 404-page error, but if I moved my .html to a subdirectory such as dist and declare root: 'dist', it worked.

Please help how to configure the connect.server () root option to search for files in the project root directory?

Thank.

+4
source share
1 answer

Finally, I work with root: [__dirname]

+4
source

Source: https://habr.com/ru/post/1530157/


All Articles