Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEXT CANARY] Tailwind config file is wrong #47276

Closed
1 task done
Dun-sin opened this issue Mar 18, 2023 · 5 comments
Closed
1 task done

[NEXT CANARY] Tailwind config file is wrong #47276

Dun-sin opened this issue Mar 18, 2023 · 5 comments
Labels
bug Issue was opened via the bug report template.

Comments

@Dun-sin
Copy link

Dun-sin commented Mar 18, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 16.15.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.2.5-canary.8
      eslint-config-next: 13.2.4
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

CLI (create-next-app)

Link to the code that reproduces this issue

terminal

To Reproduce

create a new next project using the canary cli, pick no to using the app directory type, after installation run npm run dev

This happened tailwind content was:

content: [
		'./pages/**/*.{js,ts,jsx,tsx}',
		'./components/**/*.{js,ts,jsx,tsx}',
		'./app/**/*.{js,ts,jsx,tsx}',
	],

instead of:

content: [
		'./pages/**/*.{js,ts,jsx,tsx}',
		'./components/**/*.{js,ts,jsx,tsx}',
		'./src/**/*.{js,ts,jsx,tsx}',
	],

Describe the Bug

The tailwind styles don't work, but the global styles do

Expected Behavior

Tailwind styling should work

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@Dun-sin Dun-sin added the bug Issue was opened via the bug report template. label Mar 18, 2023
@alexshyba
Copy link

Not sure if it's the same issue, but I had a similar issue if I select "yes" to "src" directory:

 Would you like to use `src/` directory with this project? ...  Yes

The page is broken:
image

Workaround - manually add src/ prefix to content paths in tailwind.config.js:

  content: [
    './src/pages/**/*.{js,ts,jsx,tsx}',
    './src/components/**/*.{js,ts,jsx,tsx}',
    './src/app/**/*.{js,ts,jsx,tsx}',
  ],

@Dun-sin
Copy link
Author

Dun-sin commented Mar 19, 2023

Yes it's there same issue👍🏽

@balazsorban44
Copy link
Member

Thanks, this is tracked in #47236. #47238 will fix this issue.

@Dun-sin
Copy link
Author

Dun-sin commented Mar 19, 2023

Awesome @balazsorban44, does it also run the latest next-canary? Because when I tried to get the next info using npx --no-install next info, I got the error that next-canary wasn't the latest, even when I just created a new next project using the latest CLI for next using canary

ijjk added a commit that referenced this issue Mar 20, 2023
### What?

- [x] fixes a bug in the CLI with the combination of `--tailwind` and
`--src-dir` flags.
- [x] fixes Tailwind CSS config when `--src-dir` is set
- [x] respect `NEXT_TEST_SKIP_CLEANUP` in test utils

### Why?

`pnpm create next-app@canary --tailwind --src-dir` should not fail.

### How?

We introduced the `app-tw` and `default-tw` templates, so we need to
respect them when working with files (in this case, the CLI was
erroneously assuming that if `template !== "app"` it must be a pages
template.)

I also noticed that the `tailwind.config.js` file need to also respect
`--src-dir` by prefixing the paths in `content`

Fixes #47236
fix NEXT-838 ([link](https://linear.app/vercel/issue/NEXT-838))

Related: #46927, #47276

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants