mirror of
https://github.com/dream-num/univer.git
synced 2026-09-01 15:29:43 +08:00
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import type { Config } from 'tailwindcss';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import preset from '@univerjs-infra/shared/tailwind';
|
|
import animate from 'tailwindcss-animate';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
const packagesDir = fs.readdirSync(path.resolve(__dirname, '../packages')).map((dir) => path.resolve(__dirname, `../packages/${dir}`));
|
|
const packagesExperimentalDir = fs.readdirSync(path.resolve(__dirname, '../common')).map((dir) => path.resolve(__dirname, `../common/${dir}`));
|
|
|
|
const tailwindProjects = packagesDir.concat(packagesExperimentalDir).reduce((acc, dir) => {
|
|
const tailwindConfig = path.resolve(dir, 'tailwind.config.ts');
|
|
if (fs.existsSync(tailwindConfig)) {
|
|
acc.push(`${dir}/src/**/*.{js,ts,jsx,tsx}`);
|
|
}
|
|
return acc;
|
|
}, [] as string[]);
|
|
|
|
const config: Config = {
|
|
presets: [preset],
|
|
content: [
|
|
'./src/**/*.{js,ts,jsx,tsx}',
|
|
...tailwindProjects,
|
|
],
|
|
plugins: [
|
|
animate,
|
|
],
|
|
};
|
|
|
|
export default config;
|