// 配置参照：https://tailwindcss.com/docs/optimizing-for-production
// 也可以参照：https://nexxai.dev/tell-purgecss-to-ignore-purging-all-tailwind-colours/
const colors = require("tailwindcss/colors");
// 生成1-100的padding和margin
const space = {
  full: "100%",
};
for (let i = 0; i < 300; i += 1) {
  space[`${i}px`] = `${i}px`;
}

const len = {
  ...space,
  flow: "82px",
};

const buildItem = (prefix, exts = ["vue", "js", "jsx", "ts", "tsx"]) =>
  `${prefix}/**/*.{${exts.join(",")}}`;
const commonDirs = process.env.LOWCODE_DEBUGGER
  ? [
      "components",
      "layouts",
      "pages",
      "plugins",
      "lowcode",
      "node_modules/@mega-apps/lowcode/lowcode",
    ]
  : ["components", "layouts", "pages", "plugins", "lowcode"];

// 以下是示例代码，你可以根据自己项目特点，配置主题，变量，插件，优化等内容
module.exports = {
  mode: "jit",
  corePlugins: {
    preflight: false,
  },
  theme: {
    colors: {
      ...colors,
      transparent: "transparent",
      flow: {
        DEFAULT: "#1890FF",
        light: "#12D1EA",
      },
      primary: {
        DEFAULT: "#1890FF",
      },
      activeColor: "#53a8d8",
    },
    extend: {
      width: {
        ...len,
      },
      height: {
        ...len,
      },
      padding: space,
      margin: space,
      maxWidth: {
        card: "380px",
      },
      maxHeight: {
        card: "129px",
      },
      inset: {
        ...len,
      },
      colors: {
        bg: "#ececec",
      },
    },
  },
  variants: {
    extend: {
      text: ["colors"],
    },
  },
  plugins: [],
  purge: {
    content: [
      // nuxt_mom 扩展指定的目录，你可以根据实际情况自己配置
      ...commonDirs.map((dir) => buildItem(`./.nuxt_mom/${dir}`)),
      // 默认值
      ...commonDirs.map((dir) => buildItem(`./${dir}`)),
      // 其他
      "./nuxt.config.js",
      "./nuxt.config.ts",
    ],
    options: {
      // safelist: [/(from|via|to|border|bg|text)-(.*)-(\\d{1}0{1,2})/]
    },
  },
};
