这是indexloc提供的服务,不要输入任何密码
Skip to content

Is it possible to use Tailwind (PostCSS) with TSUP? #883

@osvaldokalvaitir

Description

@osvaldokalvaitir

In the documentation it says that it has experimental CSS support but I couldn't execute it, I did the steps below:

Installation:

npm install tailwindcss postcss autoprefixer --save-dev

tailwind.config.js

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ['./src/**/*.{js,ts,jsx,tsx}'],
  theme: {
    extend: {},
  },
  plugins: [],
}

postcss.config.js

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}

or

module.exports = {
  plugins: [require('tailwindcss')(), require('autoprefixer')()],
}

src/styles/globals.css

@tailwind base;
@tailwind components;
@tailwind utilities;

src/index.tsx

import './styles/globals.css'

code...

package.json

scripts:
"build": "tsup src/index.tsx --format esm,cjs --dts --external react",

In the dist folder it is still returning an index.css file instead of joining

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions