How to use the react-static.pathJoin function in react-static

To help you get started, we’ve selected a few react-static examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-static / react-static / packages / react-static-plugin-source-filesystem / src / node.api.js View on Github external
const template = nodePath.resolve(page)
          // Make sure the path is relative to the location root
          let path = nodePath.relative(location, template)
          // Cutoff the extension
          path = nodePath.join(
            nodePath.dirname(path),
            nodePath.basename(path, nodePath.extname(path))
          )
          // Ensure paths are unix
          path = path.split(nodePath.sep).join(nodePath.posix.sep)
          // Make sure it starts with a slash
          path = path[0] === '/' ? path : `/${path}`
          // Turn `/index` paths into roots`
          path = path.replace(/\/index$/, '/')
          // Add the path prefix
          path = pathPrefix ? pathJoin(pathPrefix, path) : path
          // Return the route
          return createRoute({
            path,
            template,
            originalPath,
          })
        })
      )
github react-static / react-static / packages / react-static-plugin-sitemap / src / buildXML.js View on Github external
export function getPermaLink(path, prefixPath) {
  const permalink = `${prefixPath}${pathJoin(path)}`
  return `${permalink}/`.replace(REGEX_TO_GET_LAST_SLASH, '/')
}