In Tailwind 4.0 gibt es keine Datei twilwind.config.ts Datei. Wie konfiguriere ich dieses Thema jetzt im nächsten JS?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: In Tailwind 4.0 gibt es keine Datei twilwind.config.ts Datei. Wie konfiguriere ich dieses Thema jetzt im nächsten JS?

by Anonymous » 09 Mar 2025, 09:25

Hier ist die Datei tailwind.config.ts, die ich in meinem Projekt hinzufügen muss, aber in Tailwind V4 habe ich keine Datei tailwind.config.ts. Bitte sagen Sie mir eine Lösung, um dieses Problem zu lösen. Ich konnte keine Lösung dafür finden.

Code: Select all

const svgToDataUri = require("mini-svg-data-uri");

const colors = require("tailwindcss/colors");
const {
default: flattenColorPalette,
} = require("tailwindcss/lib/util/flattenColorPalette");

/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{ts,tsx}"],
darkMode: "class",
theme: {
// rest of the code
},
plugins: [
addVariablesForColors,
function ({ matchUtilities, theme }: any) {
matchUtilities(
{
"bg-grid": (value: any) => ({
backgroundImage: `url("${svgToDataUri(
``
)}")`,
}),
"bg-grid-small": (value: any) => ({
backgroundImage: `url("${svgToDataUri(
``
)}")`,
}),
"bg-dot": (value: any) => ({
backgroundImage: `url("${svgToDataUri(
``
)}")`,
}),
},
{ values: flattenColorPalette(theme("backgroundColor")), type: "color" }
);
},
],
};

function addVariablesForColors({ addBase, theme }: any) {
let allColors = flattenColorPalette(theme("colors"));
let newVars = Object.fromEntries(
Object.entries(allColors).map(([key, val]) => [`--${key}`, val])
);

addBase({
":root": newVars,
});
} ```

Top