tailwindcss styling not applied. [NOT FIXED] HELP
Answered
Collared Plover posted this in #help-forum
Collared PloverOP
pages/_app.js:
pages/index.js
styles/globals.css
import "../styles/globals.css"
import {NextUIProvider} from '@nextui-org/react'
function Application({ Component, pageProps }) {
return (
<NextUIProvider>
<Component {...pageProps} />
</NextUIProvider>
)
}
export default Application;pages/index.js
import Head from 'next/head'
import Header from '../components/Header'
import Footer from '../components/Footer'
export default function Home() {
return (
<div className="container">
<Head>
<title>Next.js Starter!</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<main>
<Header title="Welcome to my app!" />
<p className="description">
Get started by editing <code>pages/index.js</code>
</p>
</main>
<Footer />
</div>
)
}styles/globals.css
@tailwind base;
@tailwind components;
@tailwind utilities;
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell,
Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
* {
box-sizing: border-box;
}
main {
padding: 5rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
code {
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-family: Menlo, Monaco, Lucida Console, Courier New, monospace;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}Answered by Plott Hound
read this page:
https://nextui.org/docs/frameworks/nextjs
there is a template you can use to get started:
App Router:
Pages Router:
https://nextui.org/docs/frameworks/nextjs
there is a template you can use to get started:
App Router:
npx create-next-app -e https://github.com/nextui-org/next-app-templatePages Router:
npx create-next-app -e https://github.com/nextui-org/next-pages-template133 Replies
Collared PloverOP
the styles aren't applied:
vercel:
tailwind.config.js:
const { nextui } = require("@nextui-org/react");
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
// ...
"./pages/*.{html,js,ts,jsx,tsx}",
"./pages/**/*.{html,js,ts,jsx,tsx}",
"./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}"
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [nextui()]
}the header
import React from "react";
import {Navbar, NavbarBrand, NavbarMenuToggle, NavbarMenuItem, NavbarMenu, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
import {logo} from "../public/icon.jsx";
export default function App() {
const [isMenuOpen, setIsMenuOpen] = React.useState(false);
const menuItems = [
"Profile",
"Dashboard",
"Activity",
"Analytics",
"System",
"Deployments",
"My Settings",
"Team Settings",
"Help & Feedback",
"Log Out",
];
return (
<Navbar
isBordered
isMenuOpen={isMenuOpen}
onMenuOpenChange={setIsMenuOpen}
>
<NavbarContent className="sm:hidden" justify="start">
<NavbarMenuToggle aria-label={isMenuOpen ? "Close menu" : "Open menu"} />
</NavbarContent>
<NavbarContent className="sm:hidden pr-3" justify="center">
<NavbarBrand>
<logo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
</NavbarContent>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarBrand>
<logo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link href="#" aria-current="page">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="warning" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
<NavbarMenu>
{menuItems.map((item, index) => (
<NavbarMenuItem key={`${item}-${index}`}>
<Link
className="w-full"
color={
index === 2 ? "warning" : index === menuItems.length - 1 ? "danger" : "foreground"
}
href="#"
size="lg"
>
{item}
</Link>
</NavbarMenuItem>
))}
</NavbarMenu>
</Navbar>
);
}Collared PloverOP
how to fix?
Collared PloverOP
my tailwind.config.js is updated:
const { nextui } = require("@nextui-org/react");
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
// ...
"./pages/**/*.{html,js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}"
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [nextui()]
}styling still not applied
what file path of the route in which the style is not getting applied?
@aardani what file path of the route in which the style is not getting applied?
Collared PloverOP
currently it only have a header, and tailwindcss is not applied in it ðŸ˜
what file path of the route in which the style is not getting applied?
@aardani what file path of the route in which the style is not getting applied?
Collared PloverOP
components/Header.js
i use the header at pages/index.js
can you reproduce the issue on a new project?
Collared PloverOP
wdym
create a new project, try to reproduce the bug
try to intentionally find out what causes the bug
Collared PloverOP
i tried all the ways😠stackoverflow, discord , kapa.ai
thats not what i meant
Collared PloverOP
can i just do it in this project
what should i do
like in this case theres too much unknonwn
it could be from NextUI?
it could be from Tailwind?
it could be from using NextUI with Tailwind?
it could be from NextUI?
it could be from Tailwind?
it could be from using NextUI with Tailwind?
You should try reproducing the bug on a new project
Collared PloverOP
what should i do in the project?
try to reproduce the bug.
Collared PloverOP
i don't need to make another copy of this repo
you dont need to
Collared PloverOP
i can do it in this
sorry i don't get itðŸ˜
yeah thats because you refuse to understand
Collared PloverOP
i rlly don't get it
can you identify what causes the bug?
can you try removing stuff
Collared PloverOP
how?
like remove NextUI
Collared PloverOP
ok
does the bug still persists
Reproducing the bugs means you do it in a new project/create a copy of your proejct and remove stuff untill you found out what causes the bug
Like it should be deterministic and isolated, without other unecessary stuff thats irrelevant to the bug
@aardani Reproducing the bugs means you do it in a new project/create a copy of your proejct and remove stuff untill you found out what causes the bug
Collared PloverOP
i removed nextui stuffs
wating vercel runnin to see if styling appplied 🙂
@Collared Plover wating vercel runnin to see if styling appplied 🙂
so its only removed in Vercel?
have you tried
npm run build and npm run startCollared PloverOP
uh what
Collared PloverOP
im just remove importing nextui and remove it from packages
idk how to host local
im new to this stuff
like first creating site and install nextjs 4days ago
ok so do you know you can preview your code locally?
Collared PloverOP
how
now i found out i forgot to push
how do you code?
Collared PloverOP
😦
github
you code using github?
Collared PloverOP
yea
so no text editor app?
Collared PloverOP
it don't write the end bracketfor me
😦
have you tried VS Code? its pretty popular for web developers
Collared PloverOP
i'll check it soon
(:
no like, check it now
or ill refuse to help
Collared PloverOP
ok
how do you even learn how to use NextUI?
Collared PloverOP
i want to give up
how do you learn how to make next.js project?
Collared PloverOP
the header still there
@aardani how do you learn how to make next.js project?
Collared PloverOP
google
what article did you use?
@Collared Plover the header still there
Collared PloverOP
eveni removed it from index.js
nextjs docs
how did you generate a Next.js project?
Collared PloverOP
i folliwed the steps
copied from netlify
github template
ahh
Collared PloverOP
and rmeoved those netlify stuffs
So
Collared PloverOP
and updatethe versions
🙂
frompackages.json
so i want to give up
the header stuck there
Im just going to tell you right now, as much as you want to give up, its not really recommended to code in Github for basically anything
Collared PloverOP
even i uninstalled nextui
the whole page won't change
whole projects sucks
/Mark Solution
Plott Hound
ive used nextui a lot and it works great
Collared PloverOP
can u send me your git link
😦
u can remkve all your stuffs
and just original ones
i wanna find out
):
Plott Hound
Once you're setup in VSCode with Git feel free to message me
but it sounds like you are missing some fundamentals
Collared PloverOP
sry i can't install vscode
i have some personal problems
can u send me the pages/_app.js the index, globals styles cssfile and tailwind.condig.js?
🥺
You dont need vscode, just get Git and any texteditor like Notepad++ or sublime
theres other editor that exists if you have personal problem with vscode
Plott Hound
read this page:
https://nextui.org/docs/frameworks/nextjs
there is a template you can use to get started:
App Router:
Pages Router:
https://nextui.org/docs/frameworks/nextjs
there is a template you can use to get started:
App Router:
npx create-next-app -e https://github.com/nextui-org/next-app-templatePages Router:
npx create-next-app -e https://github.com/nextui-org/next-pages-templateAnswer
Plott Hound
There is also a NextUI discord server that might provide more specific help. but it's a very small community so don't expect miracles.
I really want to help you but its been frustating so far. You will get better help if you cooperate and make it easier and i believe thats what we both want
Plott Hound
Sometimes trying to solve a problem can take a long time and make us very frustrated. Take a break and come back fresh.
If you try the templates I shared you should be able to get up and running.
Highly recommend you setup a local dev environment to get started.
If you try the templates I shared you should be able to get up and running.
Highly recommend you setup a local dev environment to get started.
Collared PloverOP
i have personal problems on setting localenv
so i can't do that
i don't have console
@Plott Hound read this page:
https://nextui.org/docs/frameworks/nextjs
there is a template you can use to get started:
App Router:
`npx create-next-app -e https://github.com/nextui-org/next-app-template`
Pages Router:
`npx create-next-app -e https://github.com/nextui-org/next-pages-template`
Collared PloverOP
i don't know typescript ðŸ˜
didn't even ever created a typescript file
im js newbie
@Collared Plover i don't know typescript ðŸ˜
Plott Hound
idk then, maybe ask chatgpt to convert the tsx/ts files into js
Collared PloverOP
chatgpt doesn't work
it's a trash model
worse output
i'll just try
@Plott Hound idk then, maybe ask chatgpt to convert the tsx/ts files into js
Collared PloverOP
what's the difference between app template and pages template?
@Collared Plover what's the difference between app template and pages template?
Plott Hound
I think that’s a question for another help post. This help post has become convoluted and doesn’t relate to your original problem of tailwind css not being applied
Collared PloverOP
ok i'll just ask @Silver Marten
Collared PloverOP
probelm solved!
/Mark Solution
@Collared Plover probelm solved!
what fixed this?
ie which message (can send link)