[*] Starten Sie ein Node.js-Projekt mit:
Code: Select all
npm init -y
< /code>
< /li>
Installieren Sie den Mischwind-CSS mit:
npm install -D tailwindcss
< /code>
< /li>
Hinzufügen eines Skripts zu package.json < /code> Für die CSS-Kompilierung:
"scripts": {
"css:build": "npx tailwindcss -o ./wwwroot/css/styles.css --minify"
}
< /code>
< /li>
Initialisieren Sie die Tailwind-Konfiguration mit:
npx tailwindcss init
< /code>
< /li>
modifizierenmodule.exports = {
content: [
'./Pages/**/*.cshtml',
'./Views/**/*.cshtml'
],
theme: {
extend: {},
},
plugins: [],
}
Code: Select all
@tailwind base;
@tailwind components;
@tailwind utilities;
< /code>
< /li>
Modify .csproj < /code> Datei, um sicherzustellen, dass das CSS vor der Bereitstellung erstellt wird:
>
< /code>
< /li>
Fügen Sie die generierte CSS-Datei in _layout.cshtml < /code>:
ein.
< /code>
< /li>
< /ol>
In Tailwind CSS v4, der herkömmlichen Konfigurationsdatei (jedoch in Tailwind CSS v4 (herkömmliche Konfigurationsdatei () (tailwind.config.js
Da der Ordner von .bin nicht mehr CSS mit dem Rückenwind enthält, wird der Build -Prozess nicht korrekt angewendet. Kern -MVC -Projekt? Da NPX Tailwindcss -i nicht mehr unterstützt wird, was ist die neue Best Practice für die Behandlung von CSS -Kompilierung?>