return lit.location
txtUpdated 139w ago
{ src: '/testing/paths.lit',
  root: '/',
  base: 'https://dotlit.org/',
  query: {} }
const {join, dirname, relative, resolve, normalize} = lit.utils.path
const {src,base,root} = lit.location

const full = join(base, root, src)

const ghConfig = {
  prefix: '..'
// for a regular GitHub pages repo root 
// will be calculated as the a sub path 
// of the domain root
const ghRoot = '/pages-repo'
const gh = join(ghRoot, ghConfig.prefix, src)

// resolving links relative to file and root

const test = {
  src: '/my/nested/file.lit',
  root: '/not-at-root',
  link: '../another/file.lit',

const link = join(test.root, dirname(test.src), test.link)
const linkCanonical = resolve(dirname(test.src), test.link)

// resolving relative path between 2 canonical srcs

const rel = relative(dirname(src), test.src)

// revolving cell sources to gh path

const sourceGH = relative(dirname('/meta/test.lit'), '../../escape.json')

return {full, gh, link, linkCanonical, rel, sourceGH}
txtUpdated 139w ago
{ full: 'https:/dotlit.org/testing/paths.lit',
  gh: '/testing/paths.lit',
  link: '/not-at-root/my/another/file.lit',
  linkCanonical: '/my/another/file.lit',
  rel: '../my/nested/file.lit',
  sourceGH: '../escape.json' }