-
Notifications
You must be signed in to change notification settings - Fork 218
Custom config path or support .ts extension #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @seahindeniz. I am open to this idea but I am curious: how do you use the |
Hmm, well, I'm using Webpack and for the css loader, I'm using // webpack.config.ts
rules: [
{
test: /\.(?:s[ac]|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { importLoaders: 1 } },
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
'postcss-preset-env',
['tailwindcss', { config: './tailwind.config.ts' }],
'autoprefixer',
],
},
},
},
],
},
], For the config file, I simply using it like the following: // tailwind.config.ts
// !-- Do not use TS and import/export keywords since this config file will not be
// resolved as a TS file or a module file --!
module.exports = {
purge: ['**/src/**/*.{[tj]s?(x),html}'],
darkMode: 'media',
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}; Either the |
as a side note, i would really appreciate this feature too. I use tailwind but as part of an elixir/phoenix framework. This means that my tailwind config is in an |
Hey @bradlc, have you given thoughts for this so far? |
I saw in the docs:
And my situation is this... I have a React component library package that is used on multiple applications, so each individual application won't have a I sort of was able to get this working with creating a
As long as in the library you include the Then I had to install Tailwind and any extensions in the Posting this in case it helps anyone here if they are trying something similar...or maybe it's just helpful in some way. |
+1 on this request if possible @bradlc 🙏 We have multiple tailwind config files in our project, and being able to set the tailwind config directory would be amazing. |
For anyone who comes across this issue, my workaround is to import import autoprefixer from 'autoprefixer';
import tailwindcss from 'tailwindcss';
import tailwindcssConfig from './tailwind.config';
export default { plugins: [autoprefixer, tailwindcss(tailwindcssConfig)] }; |
+1 on this for me as well. We use tailwind in a monorepo setup where the master tailwind.config is not at the "project" root level...it's at the workspace root level and we just reference that during the build and it works just fine. But we get no intellisense because the tailwind config is in the "wrong place". Being able to specify this at a VS Code workspace level would be amazing. My suggestion would be to make the tailwind config a variable for the extension which, if not filled out, could default to the normal glob that it does...but could be specified. That way it could be checked in as part of VSCode's settings.json file. |
@DianaOlympos I'm having this same issue -- same scenario in an elixir phoenix app -- grateful you've pointed it out. Thanks! |
When working with Or even further I could split the theme object and import then from different modules, like: The scenario above works perfectly and all gets compiled as expected, TW does not complain about it, it is just that we lose the autocompletion feature. So yes, supporting PS: I've tested the solution provided in the PO here and compiled the extension as a |
@DianaOlympos did you ever get past this with your elixir phoenix project? you and i have a similar issue: #421 (comment) |
@megalithic no i did not. Sadly. |
To be clear; tailwindcss-language-server is working in css files when used with the |
Hello, is there any update on this issue? I'm also looking forward to be able to set my tailwindcss config in a .ts |
I've just run into this too. Would be great if it would work with my tailwind.config.ts file. |
Hey all. If your project has a single config file:
If your project has multiple config files you can use an object where each key is a config file path and the value is a glob (or array of globs) representing the files where that config applies:
If anyone has any feedback feel free to ping me in a discussion, and for bugs please open an issue on this repo 👍 Please note that this setting is experimental and may be changed or removed at any time. |
@bradlc thank you so much! |
@bradlc thanks man, you're amazing! |
@bradlc does this change support the |
Yes, as long as you don't have any TypeScript or ESM syntax in the file. |
So @bradlc basically, I cannot set my config in this way? or like: right? that would be the point (from my personal experience) of using a .ts config file 🤔 |
Hi, does anybody know how or where to define I tried creating the I have a monorepo using Thanks! |
@dgonzalezr did you found a solution? I don't see this as "resolved" if i can specify a |
@EinfachHans Actually yes, it is working for me with Tailwind CSS v3, you can check this repo here. |
If anyone else is having problems, this may help: |
Hi,
Is there a way to specify a custom config file name instead of
tailwind.config.js
.For example, I don't like to have JS files in my project, so I use
tailwind.config.ts
with vanilla ES6 syntax just for shadowing the JS file extension. But in the meantime, I'm loosing intellisense feature of the extension. So in this case, I think having a config for specifying path is kind of needed.Alternatively, these lines can have
ts
extension just to cover the issue.tailwindcss-intellisense/packages/vscode-tailwindcss/src/extension.ts
Line 40 in 898347c
tailwindcss-intellisense/packages/tailwindcss-language-server/src/server.ts
Line 75 in 6e092dd
The text was updated successfully, but these errors were encountered: