MCPcopy
hub / github.com/tailwindlabs/tailwindcss / replacerForDeclaration

Function replacerForDeclaration

packages/@tailwindcss-node/src/urls.ts:54–68  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

52 let promises: Promise<void>[] = []
53
54 function replacerForDeclaration(url: string) {
55 if (url[0] === '/') return url
56
57 let absoluteUrl = path.posix.join(normalizePath(base), url)
58 let relativeUrl = path.posix.relative(normalizePath(root), absoluteUrl)
59
60 // If the path points to a file in the same directory, `path.relative` will
61 // remove the leading `./` and we need to add it back in order to still
62 // consider the path relative
63 if (!relativeUrl.startsWith('.')) {
64 relativeUrl = './' + relativeUrl
65 }
66
67 return relativeUrl
68 }
69
70 walk(ast, (node) => {
71 if (node.kind !== 'declaration') return

Callers

nothing calls this directly

Calls 1

normalizePathFunction · 0.90

Tested by

no test coverage detected