简体   繁体   中英

Tailwind not loaded with nextjs

I'm tring to crete an app using tailwindcss and next.js

I sterted creating the nextjs app, then I runned these commands:

npm install -D tailwindcss postcss autoprefixer

npx tailwindcss init -p

After that I updated the tailwind.config.js like:

module.exports = {
  content: [
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

And, then I created and populated the./syles/globals.css with:

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

all this step by step is on the website: https://tailwindcss.com/docs/guides/nextjs but still any attempt at customization doesn't work, is there any way to know if tailwind has been loaded? Was there something missing to be done?

在此处输入图像描述

Firstly import globals.css into _app.js

import '../styles/globals.css'

Also instead of @tailwind do below to add tailwind into globals.css

/* @tailwind base;
@tailwind components;
@tailwind utilities; */

@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM