Repository navigation
Improvement Ideas For Payload Web Template #18706
Chamith-Dilshan
started this conversation in
Feature Requests & Ideas
Replies: 2 comments
|
I did some new changes and tried few things.
yeah, its broken now. but that is to be expected. if you ever see a white page for the frontend don't panic :) just go to the global.css file yeah good luck. the template is okay. but this is what i usually would like to use based on past project experiences. that's why i change it. but i think it is worth it. |
0 replies
|
almost forgot. one more thing. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I created a new Payload CMS project using the official website template with the following versions:
While going through the generated code, I found a few configuration improvements that could be useful for new projects. These changes focus on cleaning up legacy code, improving formatting and linting, and updating Tailwind CSS to v4.
1. Remove the Old SCSS File
Remove the old SCSS file:
src/app/(payload)/custom.scssAlso remove its imports from the following files:
(payload)/layout.tsxAdminBar/index.tsxBeforeDashboard/index.tsxSeedButton/index.tsx2. Improve
.editorconfigYou can simplify the
.editorconfigfile and removemax_line_length = null. Usingnullfor this setting can cause an error.Since Prettier configuration already has "printWidth": 80, I'd recommend removing max_line_length entirely to avoid duplicating formatting rules.
Use the following configuration:
3. Update
.gitignoreConsider updating
.gitignoreto exclude IDE-specific files and directories, such as:.idea/.vscode/Adjust these entries according to your team's workflow. If your team shares VS Code workspace settings, you may want to ignore only local or personal settings rather than the entire
.vscode/directory.4. Configure Prettier
Add the following entries to
.prettierignore:Install Prettier and the Tailwind CSS plugin:
Create a
.prettierrc.jsonfile with the following configuration:{ "endOfLine": "lf", "semi": false, "singleQuote": false, "tabWidth": 2, "trailingComma": "es5", "printWidth": 80, "plugins": ["prettier-plugin-tailwindcss"], "tailwindStylesheet": "src/app/(frontend)/globals.css", "tailwindFunctions": ["cn", "cva"] }This configuration keeps formatting consistent and enables automatic Tailwind CSS class sorting.
Note: Ensure the
tailwindStylesheetpath matches your actual stylesheet location.5. Configure ESLint and Prettier Together
When ESLint and Prettier are used in the same project, their rules can conflict. You can prevent these conflicts by using
eslint-config-prettier.Install it:
Important considerations
.eslintignoreis deprecated when using flat ESLint configuration. Move ignore patterns intoeslint.config.mjs.FlatCompatto convert legacy Next.js configurations if you encounter circular-reference errors. Prefer the native flat configurations provided by your installedeslint-config-nextversion.Example
eslint.config.mjsExample development dependencies
The versions I found in my setup were:
{ "eslint-config-next": "16.3.3", "eslint-config-prettier": "^10.1.8", "prettier": "^3.9.10", "prettier-plugin-tailwindcss": "^0.8.1" }These are the versions I tried, not a guarantee that every combination is compatible with the versions listed at the beginning. Check the installed package compatibility before copying them directly.
Also You can inspect your ESLint configuration using:
6. Update
tsconfig.jsonRemove the deprecated
baseUrloption:TypeScript 6 warns about this option, and the planned TypeScript 7 removal makes it worth addressing early.
When removing
baseUrl, double-check yourpathsconfiguration. For the current template, the following aliases may be sufficient:{ "paths": { "@payload-config": ["./src/payload.config.ts"], "react": ["./node_modules/@types/react"], "@/*": ["./src/*"] } }Review the actual paths in your project and update imports wherever errors appear. Don't assume every existing alias will behave identically after changing the configuration.
7. Upgrade Tailwind CSS to v4
The template already includes a recent Tailwind CSS version, but some configuration and coding patterns may still come from v3.
Start with the official upgrade tool:
[Official Tailwind CSS Upgrade Guide](https://tailwindcss.com/docs/upgrade-guide)
After the upgrade tool run, you have to review the remaining code manually.
Migrate custom utilities
For example, a custom container previously defined under
@layer utilities:Can be migrated to Tailwind v4's utility style:
However, Tailwind v4 already provides a native
containerutility. If the default behavior is sufficient, use the built-in utility instead of recreating it.Remove
tailwind.config.mjsThe goal is to use Tailwind v4's CSS-first configuration rather than retain the legacy JavaScript configuration file.
Before deleting it, migrate any configuration you still depend on, including custom theme values, colors, plugins, and other settings.
Update fonts in
layout.tsxFor example:
Apply the font variables to the HTML element:
Then configure the corresponding font variables in
globals.css.Because the variables are already named
--font-monoand--font-sans, don't redefine them as self-referencing variables inside@theme. Use the font-variable references appropriate to your chosen Tailwind v4 setup.Create your own theme
I recommend using shadcn/ui, which is already included in the project.
You can do manually or you can generate a theme using [tweakcn](https://tweakcn.com/) and import the resulting CSS.
8. Final
globals.cssBaselineThe following is the final baseline without the theme data. You can add your theme variables through shadcn/ui.
Important: This is the baseline from website template. The actual
@themevalues should reference the font variables provided bynext/font, and the semantic color variables must be defined by your theme.9. Verify the Migration
After applying these changes:
The migration may introduce styling differences, but fixing them early is generally easier than carrying legacy configuration into future development.
And you may find some Issues related to useEffect, those are code errors that need to fix seperatly.
That's what I've found so far. I'll update this document if I discover anything else. Let me know if these changes help with your setup, and feel free to share any issues or improvements you find.
All reactions