Tailwind is a utility-first CSS framework.
This text describes the way to arrange Tailwind with Subsequent.js.
Set up
npm i --save-dev tailwindcss
npm i --save-dev postcss
npm i --save-dev autoprefixer
Init
npx tailwindcss init -p
Setting
// tailwind.config.js
module.exports = {
content material: ["./src/**/*.{js,ts,jsx,tsx}"],
theme: {
prolong: {},
},
plugins: [],
};
Write
/* src/types/globals.css */
@tailwind base;
@tailwind parts;
@tailwind utilities;
Utilizing Tailwind in Web page
// src/pages/instance.tsx
const Web page = (): JSX.Aspect => {
return (
<p data-testid="textual content" className="underline">
Howdy
</p>
);
};
export default Web page;
Test
npm run dev
http://localhost:3000/instance
Assist for Visible Studio Code
// .vscode/extensions.json
{
"suggestions": ["bradlc.vscode-tailwindcss"]
}
Assist for ESLint
npm i --save-dev eslint-plugin-tailwindcss
// .eslintrc.json
{
"extends": [
// ...
"plugin:tailwindcss/recommended"
],
// ...
}