Support tailwind.config.ts (#1247)

Fixes #659
Fixes #633

Create Next App is using `tailwind.config.ts` in the TypeScript template. Since this is a very common use case it would be nice to preserve the type safety of the file.

I added new templates for TypeScript files. I see there is an issue #1073 which asks for ESM support as well. This is not included in this PR.

I also fixed the type error in the keyframes that is also handled in #636
This commit is contained in:
Luka Hartwig
2023-10-19 19:44:11 +02:00
committed by GitHub
parent 9091dcdc1b
commit 4ec8a67dab
9 changed files with 159 additions and 21 deletions

View File

@@ -51,7 +51,7 @@ test("init config-full", async () => {
expect(mockWriteFile).toHaveBeenNthCalledWith(
1,
expect.stringMatching(/tailwind.config.ts$/),
expect.stringContaining(`/** @type {import('tailwindcss').Config} */`),
expect.stringContaining(`import type { Config } from "tailwindcss"`),
"utf8"
)
expect(mockWriteFile).toHaveBeenNthCalledWith(
@@ -121,7 +121,7 @@ test("init config-partial", async () => {
expect(mockWriteFile).toHaveBeenNthCalledWith(
1,
expect.stringMatching(/tailwind.config.ts$/),
expect.stringContaining(`/** @type {import('tailwindcss').Config} */`),
expect.stringContaining(`import type { Config } from "tailwindcss"`),
"utf8"
)
expect(mockWriteFile).toHaveBeenNthCalledWith(

View File

@@ -58,12 +58,12 @@ module.exports = {
},
keyframes: {
"accordion-down": {
from: { height: 0 },
from: { height: "0" },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: 0 },
to: { height: "0" },
},
},
animation: {