1 import path from "path"
2 import coreConfig from "tailwind"
3
4 // Get two levels up from require.resolve("@medusajs/ui")
5 const root = path.join(require.resolve("@medusajs/ui"), "../..")
6 const uiPath = path.join(root, "**/*.{js,ts,jsx,tsx,mdx}")
7
8 // filter out unwanted config from the core theme
9 // eslint-disable-next-line @typescript-eslint/no-unused-vars
10 const { spacing, ...coreTheme } = coreConfig.theme || {}
11 // filter out unwanted config from extended theme
12 // eslint-disable-next-line @typescript-eslint/no-unused-vars
13 const { borderRadius, ...extendedTheme } = coreConfig.theme?.extend || {}
14
15 // remove core spacing except those having "docs" prefix
16 const modifiedSpacing = {}
17 Object.entries(coreConfig.theme.spacing)
18 .filter(([key]) => key.startsWith("docs_"))
19 .map(([key, value]) => {
20 modifiedSpacing[key] = value
21 })
22
23 // remove core border radius except those having "docs" prefix
24 const modifiedRadius = {}
25 Object.entries(coreConfig.theme.extend.borderRadius)
26 .filter(([key]) => key.startsWith("docs_"))
27 .map(([key, value]) => {
28 modifiedRadius[key] = value
29 })
30
31 module.exports = {
32 ...coreConfig,
33 content: [...coreConfig.content, "./**/*.{js,ts,jsx,tsx,mdx}", uiPath],
34 theme: {
35 ...coreTheme,
36 extend: {
37 ...extendedTheme,
38 container: {
39 center: true,
40 screens: {
41 "2xl": "1400px",
42 },
43 },
44 borderRadius: modifiedRadius,
45 spacing: modifiedSpacing,
46 },
47 backgroundImage: {
48 "bg-stripes": "url('/ui/images/bg-stripes.png')",
49 "bg-stripes-dark": "url('/ui/images/bg-stripes-dark.png')",
50 },
51 },
52 }