chore: init project
This commit is contained in:
11
internal/tailwind-config/build.config.ts
Normal file
11
internal/tailwind-config/build.config.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { defineBuildConfig } from 'unbuild';
|
||||
|
||||
export default defineBuildConfig({
|
||||
clean: true,
|
||||
declaration: true,
|
||||
entries: ['src/index', './src/postcss.config'],
|
||||
externals: ['@vben/node-utils'],
|
||||
rollup: {
|
||||
emitCJS: true,
|
||||
},
|
||||
});
|
64
internal/tailwind-config/package.json
Normal file
64
internal/tailwind-config/package.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "@vben/tailwind-config",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/vbenjs/vue-vben-admin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
||||
"directory": "internal/tailwind-config"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vbenjs/vue-vben-admin/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "pnpm unbuild",
|
||||
"stub": "pnpm unbuild --stub"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"main": "./dist/index.mjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"*": [
|
||||
"./dist/*",
|
||||
"./*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"imports": {
|
||||
"#*": "./src/*"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
},
|
||||
"./postcss": {
|
||||
"types": "./src/postcss.config.ts",
|
||||
"default": "./dist/postcss.config.mjs"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify/json": "^2.2.211",
|
||||
"@iconify/tailwind": "^1.1.1",
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"cssnano": "^7.0.1",
|
||||
"postcss": "^8.4.38",
|
||||
"postcss-antd-fixes": "^0.2.0",
|
||||
"postcss-preset-env": "^9.5.13",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vben/node-utils": "workspace:*"
|
||||
}
|
||||
}
|
136
internal/tailwind-config/src/index.ts
Normal file
136
internal/tailwind-config/src/index.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
import type { Config } from 'tailwindcss';
|
||||
|
||||
import path from 'node:path';
|
||||
|
||||
import { addDynamicIconSelectors } from '@iconify/tailwind';
|
||||
import formsPlugin from '@tailwindcss/forms';
|
||||
import { fs, getPackagesSync } from '@vben/node-utils';
|
||||
import animate from 'tailwindcss-animate';
|
||||
// import defaultTheme from 'tailwindcss/defaultTheme';
|
||||
|
||||
const { packages } = getPackagesSync();
|
||||
|
||||
const tailwindPackages: string[] = [];
|
||||
|
||||
packages.forEach((pkg) => {
|
||||
// apps目录下和 @vben-core/tailwind-ui 包需要使用到 tailwindcss ui
|
||||
if (fs.existsSync(path.join(pkg.dir, 'tailwind.config.mjs'))) {
|
||||
tailwindPackages.push(pkg.dir);
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
content: [
|
||||
'./index.html',
|
||||
...tailwindPackages.map((item) =>
|
||||
path.join(item, 'src/**/*.{vue,js,ts,jsx,tsx,svelte,astro,html}'),
|
||||
),
|
||||
],
|
||||
darkMode: 'class',
|
||||
plugins: [animate, formsPlugin, addDynamicIconSelectors()],
|
||||
prefix: '',
|
||||
safelist: ['dark'],
|
||||
theme: {
|
||||
container: {
|
||||
center: true,
|
||||
padding: '2rem',
|
||||
screens: {
|
||||
'2xl': '1400px',
|
||||
},
|
||||
},
|
||||
extend: {
|
||||
animation: {
|
||||
'accordion-down': 'accordion-down 0.2s ease-out',
|
||||
'accordion-up': 'accordion-up 0.2s ease-out',
|
||||
'collapsible-down': 'collapsible-down 0.2s ease-in-out',
|
||||
'collapsible-up': 'collapsible-up 0.2s ease-in-out',
|
||||
float: 'float 5s linear 0ms infinite',
|
||||
},
|
||||
borderRadius: {
|
||||
lg: 'var(--radius-base)',
|
||||
md: 'calc(var(--radius-base) - 2px)',
|
||||
sm: 'calc(var(--radius-base) - 4px)',
|
||||
xl: 'calc(var(--radius-base) + 4px)',
|
||||
},
|
||||
colors: {
|
||||
accent: {
|
||||
DEFAULT: 'hsl(var(--color-accent))',
|
||||
foreground: 'hsl(var(--color-accent-foreground))',
|
||||
hover: 'hsl(var(--color-accent-hover))',
|
||||
},
|
||||
background: 'hsl(var(--color-background) / <alpha-value>)',
|
||||
body: 'hsl(var(--color-body) / <alpha-value>)',
|
||||
border: 'hsl(var(--color-border))',
|
||||
card: {
|
||||
DEFAULT: 'hsl(var(--color-card))',
|
||||
foreground: 'hsl(var(--color-card-foreground))',
|
||||
},
|
||||
destructive: {
|
||||
DEFAULT: 'hsl(var(--color-destructive))',
|
||||
foreground: 'hsl(var(--color-destructive-foreground))',
|
||||
},
|
||||
foreground: 'hsl(var(--color-foreground) / <alpha-value>)',
|
||||
heavy: {
|
||||
DEFAULT: 'hsl(var(--color-heavy) / <alpha-value>)',
|
||||
foreground: 'hsl(var(--color-heavy-foreground) / <alpha-value>)',
|
||||
},
|
||||
input: {
|
||||
DEFAULT: 'hsl(var(--color-input))',
|
||||
background: 'hsl(var(--color-input-background))',
|
||||
},
|
||||
muted: {
|
||||
DEFAULT: 'hsl(var(--color-muted))',
|
||||
foreground: 'hsl(var(--color-muted-foreground))',
|
||||
},
|
||||
overlay: 'hsl(var(--color-overlay))',
|
||||
popover: {
|
||||
DEFAULT: 'hsl(var(--color-popover))',
|
||||
foreground: 'hsl(var(--color-popover-foreground))',
|
||||
},
|
||||
primary: {
|
||||
DEFAULT: 'hsl(var(--color-primary) / <alpha-value>)',
|
||||
foreground: 'hsl(var(--color-primary-foreground) / <alpha-value>)',
|
||||
},
|
||||
ring: 'hsl(var(--color-ring))',
|
||||
secondary: {
|
||||
DEFAULT: 'hsl(var(--color-secondary) / <alpha-value>)',
|
||||
desc: 'hsl(var(--color-secondary-desc) / <alpha-value>)',
|
||||
foreground: 'hsl(var(--color-secondary-foreground) / <alpha-value>)',
|
||||
},
|
||||
},
|
||||
fontFamily: {
|
||||
sans: [
|
||||
'var(--font-geist-sans)',
|
||||
// ...defaultTheme.fontFamily.sans
|
||||
],
|
||||
},
|
||||
keyframes: {
|
||||
'accordion-down': {
|
||||
from: { height: '0' },
|
||||
to: { height: 'var(--radix-accordion-content-height)' },
|
||||
},
|
||||
'accordion-up': {
|
||||
from: { height: 'var(--radix-accordion-content-height)' },
|
||||
to: { height: '0' },
|
||||
},
|
||||
'collapsible-down': {
|
||||
from: { height: '0' },
|
||||
to: { height: 'var(--radix-collapsible-content-height)' },
|
||||
},
|
||||
'collapsible-up': {
|
||||
from: { height: 'var(--radix-collapsible-content-height)' },
|
||||
to: { height: '0' },
|
||||
},
|
||||
float: {
|
||||
'0%': { transform: 'translateY(0)' },
|
||||
'50%': { transform: 'translateY(-20px)' },
|
||||
'100%': { transform: 'translateY(0)' },
|
||||
},
|
||||
},
|
||||
zIndex: {
|
||||
'100': '100',
|
||||
'1000': '1000',
|
||||
},
|
||||
},
|
||||
},
|
||||
} as Config;
|
14
internal/tailwind-config/src/postcss.config.ts
Normal file
14
internal/tailwind-config/src/postcss.config.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import config from '.';
|
||||
|
||||
export default {
|
||||
plugins: {
|
||||
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {}),
|
||||
// Specifying the config is not necessary in most cases, but it is included
|
||||
autoprefixer: {},
|
||||
// 修复 element-plus 和 ant-design-vue 的样式和tailwindcss冲突问题
|
||||
'postcss-antd-fixes': { prefixes: ['ant', 'el'] },
|
||||
'postcss-preset-env': {},
|
||||
// here to share the same config across the entire monorepo
|
||||
tailwindcss: { config },
|
||||
},
|
||||
};
|
5
internal/tailwind-config/tsconfig.json
Normal file
5
internal/tailwind-config/tsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@vben/tsconfig/node.json",
|
||||
"include": ["src"]
|
||||
}
|
Reference in New Issue
Block a user