-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
Is it possible to use Tailwind (PostCSS) with TSUP? #883
Comments
I also want to use tailwindcss, but I don't want to output .css files, but support css in js, can this be done? |
I'm not sure what your exact use case is, but if you're looking to build a React library for your own use, you can just compile the code without the CSS, and include the compiled code in the CSS for your app. tailwind.config.cjs const path = require('path');
const baseConfig = require('my-library');
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./index.html',
'./src/**/*.{js,ts,jsx,tsx}',
path.join(path.dirname(require.resolve('my-library')), '**/*.{js,cjs,mjs}')
],
presets: [baseConfig]
}; |
is there a way to have tsup convert the tailwind into css so we can just import the css into our app? |
That's what I wanted too |
I tested the tsup with Rollup and tailwindcss, and it looks fine to me (i.e. the https://github.com/issueset/tsup-tailwindcss-example Going to close this issue for now, but feel free to reopen it if anyone can provide a minimal replication to show the issue when working with tsup and tailwindcss together. |
@ocavue this works, but now tree shaking is not working I copied your tailwind example you just made and added react: the tailwind works now which is great! But now tree shaking is not working. In my example i am expecting Button to be about 10kb and Accordion to add more weight once it's added in. But it looks like it's just forcing you to import the whole file.
|
I keep getting this error when I try to build my library that uses tailwind:
|
In the documentation it says that it has experimental CSS support but I couldn't execute it, I did the steps below:
Installation:
tailwind.config.js
postcss.config.js
or
src/styles/globals.css
src/index.tsx
package.json
In the dist folder it is still returning an index.css file instead of joining
Upvote & Fund
The text was updated successfully, but these errors were encountered: