async function getDocumentPath(file, options = {}) {
  let {base} = options;

  // Check remote
  if (file.remote) {
    let {pathname} = file.urlObj;
    if (/\/$/.test(pathname)) {
      pathname += 'index.html';
    }

    return pathname;
  }

  // If we don't have a file path and
  if (!file.path) {
    return '';
  }

  if (base) {
    base = path.resolve(base);
    return normalizePath(`/${path.relative(base, file.path || base)}`);
  }

  // Check local and assume base path based on relative stylesheets
  if (file.stylesheets) {
    const relativeRefs = file.stylesheets.filter((href) => isRelative(href));
    const absoluteRefs = file.stylesheets.filter((href) => isAbsolute(href));

    // If we have no stylesheets inside, fall back to path relative to process cwd
    if (relativeRefs.length === 0 && absoluteRefs.length === 0) {
      process.stderr.write(BASE_WARNING);

      return normalizePath(`/${path.relative(process.cwd(), file.path)}`);
    }

    // Compute base path based on absolute links
    if (relativeRefs.length === 0) {
      const [ref] = absoluteRefs;
      const paths = await getAssetPaths(file, ref, options);
      try {
        const filepath = await resolve(ref, paths, options);
        return normalizePath(`/${path.relative(normalizePath(filepath).replace(ref, ''), file.path)}`);
      } catch {
        process.stderr.write(BASE_WARNING);

        return normalizePath(`/${path.relative(process.cwd(), file.path)}`);
      }
    }

    // Compute path based on relative stylesheet links
    const dots = relativeRefs.reduce((res, href) => {
      const match = /^(\.\.\/)+/.exec(href);

      return match && match[0].length > res.length ? match[0] : res;
    }, './');

    const tmpBase = path.resolve(path.dirname(file.path), dots);

    return normalizePath(`/${path.relative(tmpBase, file.path)}`);
  }

  return '';
}
Compute Path to Html document based on docroot
@param {Vinyl} file The file we want to check
@param {object} options Critical options object
@returns {Promise<string>} Computed path