Versions
@terrazzo/cli: 2.0.1
@terrazzo/plugin-css: 2.0.1
@terrazzo/plugin-tailwind: 2.0.1
Node.js version
24.7.0
OS + version
26.0.1
Description
The @terrazzo/plugin-tailwind resolves the template path against two different bases, causing ENOENT errors when outDir in terrazzo.config.ts is anything other than ./.
In https://github.com/terrazzoapp/terrazzo/blob/main/packages/plugin-tailwind/dist/index.js, the existence check resolves relative to outDir:
cwd = new URL("./", config.outDir);
if (!fsSync.existsSync(new URL(options.template, cwd))) // relative to outDir
But the file read uses the raw path, which resolves relative to the process cwd:
template = await fs.readFile(options.template, "utf8"); // relative to process.cwd()
When outDir differs from the process cwd (e.g. outDir: "./src/tokens/"), no single template value satisfies both checks.
Reproduction
my-project/
terrazzo.config.ts
tokens.json
src/tokens/
tailwind-theme-template.css
// terrazzo.config.ts
export default defineConfig({
outDir: "./src/tokens/",
plugins: [
pluginTailwind({
template: "./tailwind-theme-template.css",
// ...
}),
],
});
- template:
./tailwind-theme-template.css existence check looks for ./src/tokens/tailwind-theme-template.css (found), but fs.readFile looks for ./tailwind-theme-template.css from process cwd (not found) → ENOENT
- template:
../tailwind-theme-template.css existence check looks for ./src/tailwind-theme-template.css (not found) → "Could not locate template"
Workaround: Place the template file at both locations (or use a symlink from the project root to the file in outDir).
Expected result
The template path should be resolved consistently. Either always relative to outDir, always relative to process cwd, or always relative to the config file. The same path should be used for both the existence check and the file read.
Extra
Versions
@terrazzo/cli: 2.0.1@terrazzo/plugin-css: 2.0.1@terrazzo/plugin-tailwind: 2.0.1Node.js version
24.7.0
OS + version
26.0.1
Description
The
@terrazzo/plugin-tailwindresolves the template path against two different bases, causingENOENTerrors whenoutDirinterrazzo.config.tsis anything other than./.In https://github.com/terrazzoapp/terrazzo/blob/main/packages/plugin-tailwind/dist/index.js, the existence check resolves relative to
outDir:But the file read uses the raw path, which resolves relative to the process cwd:
When
outDirdiffers from the process cwd (e.g. outDir: "./src/tokens/"), no single template value satisfies both checks.Reproduction
./tailwind-theme-template.cssexistence check looks for./src/tokens/tailwind-theme-template.css(found), butfs.readFilelooks for./tailwind-theme-template.cssfrom process cwd (not found) →ENOENT../tailwind-theme-template.cssexistence check looks for./src/tailwind-theme-template.css(not found) → "Could not locate template"Workaround: Place the template file at both locations (or use a symlink from the project root to the file in
outDir).Expected result
The template path should be resolved consistently. Either always relative to
outDir, always relative to process cwd, or always relative to the config file. The same path should be used for both the existence check and the file read.Extra