Is there a way to use tailwind.config.ts instead? #6839
Unanswered
finnmerlett
asked this question in
Help
Replies: 2 comments 1 reply
-
Use swc or esbuild to achieve this: // tailwind.config.js
const { register } = require("@swc-node/register/register")
const { readDefaultTsConfig } = require("@swc-node/register/read-default-tsconfig")
const path = require("path")
register(readDefaultTsConfig(path.join(__dirname, "tsconfig.json")))
module.exports = require("./tailwind.config.ts").default // tailwind.config.ts
export default {
plugins: [],
theme: {
extend: {},
},
} // as import("tailwindcss/types").Config |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to keep chunks of my theme in ts files elsewhere in my project. I want to be able to access them directly with type hinting but also want to be able to import them into my tailwind config file (at the moment you can only 'require' CommonJs files into the tailwind.config.js file). I wouldn't even need it to be typescript necessarily (though that would be nice), I just want to be able to import in es6 modules style. Is there any way to set this up?
Beta Was this translation helpful? Give feedback.
All reactions