nextui-org / nextui-cli

⌨️ A CLI tool that unlocks seamless NextUI integration.
MIT License
40 stars 14 forks source link

[BUG] - CLI component instalation ruined tailwind.config.js #29

Closed nicodomergue closed 4 months ago

nicodomergue commented 4 months ago

NextUI CLI Version

0.1.5

Describe the bug

I was installing the avatar component and after running nextui add avatar, waiting for the install to be completed and runing npm run dev, I was getting the following error:

image

While tracing the error checking my css related files, I noticed that the CLI had modified my tailwind.config.js file, removing some of the string quotation marks. More preciseley, the quotation marks inside the tailwind plugins array.

tailwind.config.js before executing the nextcli command:

image

tailwind.config.js after executing the nextcli command:

image After restoring the missing quotation marks, saving the file and re-running npm run dev, everithing worked as expected 🎉

Here is a full copy of my tailwind.config.js file:

const { nextui } = require("@nextui-org/theme");
import { nextui } from "@nextui-org/theme";

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "src/pages/**/*.{js,ts,jsx,tsx,mdx}",
    "src/components/**/*.{js,ts,jsx,tsx,mdx}",
    "src/app/**/*.{js,ts,jsx,tsx,mdx}",
    "./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  darkMode: "class",
  plugins: [
    nextui({
      layout: {
        radius: {
          small: "4px", // rounded-small
          medium: "6px", // rounded-medium
          large: "8px", // rounded-large
        },
      },
    }),
    require("@tailwindcss/typography"),
    nextui(),
  ],
};

Steps to Reproduce the Bug or Issue

  1. Copy the tailwind.config.js file.
  2. Run nextui add avatar.
  3. Run npm run dev.

Expected behavior

It should not remove quotation marks.

Screenshots or Videos

No response

Operating System Version

Windows