From 22a856884de9ec3358203186ac7890deb04f5c52 Mon Sep 17 00:00:00 2001 From: kangod Date: Sun, 18 Feb 2024 15:53:25 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commitlint.config.js | 30 ------------- postcss.config.js | 12 ++--- tailwind.config.js | 100 ++++++++++++++++++++--------------------- vite.config.ts | 104 +++++++++++++++++++++---------------------- 4 files changed, 108 insertions(+), 138 deletions(-) delete mode 100644 commitlint.config.js diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index 66686e4..0000000 --- a/commitlint.config.js +++ /dev/null @@ -1,30 +0,0 @@ -export default { - // 继承的规则 - extends: ['@commitlint/config-conventional'], - // 定义规则类型 - rules: { - 'body-leading-blank': [2, 'always'], // 确保提交消息正文之前有一行空白行 - 'type-empty': [2, 'never'], // 不允许提交消息的 type 类型为空 - 'subject-case': [0], // subject 大小写不做校验 - // type 类型定义,表示 git 提交的 type 必须在以下类型范围内 - 'type-enum': [ - 2, - 'always', - [ - 'feat', // 新功能 feature - 'fix', // 修复 bug - 'docs', // 文档注释 - 'style', // 代码格式(不影响代码运行的变动) - 'refactor', // 重构(既不增加新功能,也不是修复bug) - 'perf', // 性能优化 - 'test', // 添加疏漏测试或已有测试改动 - 'chore', // 构建过程或辅助工具的变动 - 'revert', // 回滚commit - 'build', // 构建流程、外部依赖变更 (如升级 npm 包、修改打包配置等)', - 'ci', // 修改CI配置、脚本 - 'types', // 类型定义文件修改 - 'wip', // 开发中 - ], - ], - }, -}; diff --git a/postcss.config.js b/postcss.config.js index e61a917..f309478 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,8 +1,8 @@ export default { - plugins: { - 'postcss-import': {}, - 'tailwindcss/nesting': 'postcss-nesting', - tailwindcss: {}, - autoprefixer: {}, - }, + plugins: { + 'postcss-import': {}, + 'tailwindcss/nesting': 'postcss-nesting', + tailwindcss: {}, + autoprefixer: {}, + }, }; diff --git a/tailwind.config.js b/tailwind.config.js index fe7a70e..1fd26be 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,58 +1,58 @@ /** @type {import('tailwindcss').Config} */ export default { - // 使用 "class" 模式时,Tailwind 会将 "dark" 类添加到根元素(通常是 元素)上,以指示页面当前处于深色模式 - darkMode: 'class', - // 通过配置 content,Tailwind CSS 将会检索和构建包含需要的 CSS 样式的文件,并生成最终的 CSS 输出文件 - content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], - theme: { - screens: { - xs: '480px', - sm: '576px', - md: '768px', - lg: '992px', - xl: '1200px', - '2xl': '1600px', - }, - colors: { - black: '#000000', - green: '#00A76F', - blue: '#1fb6ff', - purple: '#7e5bef', - pink: '#ff49db', - orange: '#ff7849', - yellow: '#ffc82c', - gray: '#637381', - hover: '#63738114', + // 使用 "class" 模式时,Tailwind 会将 "dark" 类添加到根元素(通常是 元素)上,以指示页面当前处于深色模式 + darkMode: 'class', + // 通过配置 content,Tailwind CSS 将会检索和构建包含需要的 CSS 样式的文件,并生成最终的 CSS 输出文件 + content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], + theme: { + screens: { + xs: '480px', + sm: '576px', + md: '768px', + lg: '992px', + xl: '1200px', + '2xl': '1600px', + }, + colors: { + black: '#000000', + green: '#00A76F', + blue: '#1fb6ff', + purple: '#7e5bef', + pink: '#ff49db', + orange: '#ff7849', + yellow: '#ffc82c', + gray: '#637381', + hover: '#63738114', - success: '#22c55e', - warning: '#ff7849', - error: '#ff5630', - info: '#00b8d9', + success: '#22c55e', + warning: '#ff7849', + error: '#ff5630', + info: '#00b8d9', - code: '#d63384', + code: '#d63384', - 'gray-100': '#F9FAFB', - 'gray-200': '#F4F6F8', - 'gray-300': '#DFE3E8', - 'gray-400': '#C4CDD5', - 'gray-500': '#F9FAFB', - 'gray-600': '#637381', - 'gray-700': '#454F5B', - 'gray-800': '#212B36', - 'gray-900': '#161C24', + 'gray-100': '#F9FAFB', + 'gray-200': '#F4F6F8', + 'gray-300': '#DFE3E8', + 'gray-400': '#C4CDD5', + 'gray-500': '#F9FAFB', + 'gray-600': '#637381', + 'gray-700': '#454F5B', + 'gray-800': '#212B36', + 'gray-900': '#161C24', + }, + extend: { + transitionProperty: { + height: 'height', + }, + animation: { + 'spin-slow': 'spin 8s linear infinite', + }, + }, }, - extend: { - transitionProperty: { - height: 'height', - }, - animation: { - 'spin-slow': 'spin 8s linear infinite', - }, + corePlugins: { + // Remove the Tailwind CSS preflight styles so it can use custom base style (src/theme/base.css) + preflight: false, // https://tailwindcss.com/docs/preflight#disabling-preflight }, - }, - corePlugins: { - // Remove the Tailwind CSS preflight styles so it can use custom base style (src/theme/base.css) - preflight: false, // https://tailwindcss.com/docs/preflight#disabling-preflight - }, - plugins: [], + plugins: [], }; diff --git a/vite.config.ts b/vite.config.ts index b4e0e02..fb72cca 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,58 +8,58 @@ import tsconfigPaths from 'vite-tsconfig-paths'; // https://vitejs.dev/config/ export default defineConfig({ - base: './', - esbuild: { - // drop: ['console', 'debugger'], - }, - css: { - // 开css sourcemap方便找css - devSourcemap: true, - }, - plugins: [ - react(), - // 同步tsconfig.json的path设置alias - tsconfigPaths(), - createSvgIconsPlugin({ - // 指定需要缓存的图标文件夹 - iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')], - // 指定symbolId格式 - symbolId: 'icon-[dir]-[name]', - }), - visualizer({ - open: false, - }), - ], - server: { - host: true, - port: 7442, - proxy: { - '/api': { - target: 'http://127.0.0.1:7441', - changeOrigin: true, - }, + base: './', + esbuild: { + // drop: ['console', 'debugger'], }, - }, - build: { - target: 'esnext', - minify: 'terser', - // rollupOptions: { - // output: { - // manualChunks(id) { - // if (id.includes('node_modules')) { - // // 让每个插件都打包成独立的文件 - // return id.toString().split('node_modules/')[1].split('/')[0].toString(); - // } - // return null; - // }, - // }, - // }, - terserOptions: { - compress: { - // 生产环境移除console - drop_console: true, - drop_debugger: true, - }, + css: { + // 开css sourcemap方便找css + devSourcemap: true, + }, + plugins: [ + react(), + // 同步tsconfig.json的path设置alias + tsconfigPaths(), + createSvgIconsPlugin({ + // 指定需要缓存的图标文件夹 + iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')], + // 指定symbolId格式 + symbolId: 'icon-[dir]-[name]', + }), + visualizer({ + open: false, + }), + ], + server: { + host: true, + port: 7442, + proxy: { + '/api': { + target: 'http://127.0.0.1:7441', + changeOrigin: true, + }, + }, + }, + build: { + target: 'esnext', + minify: 'terser', + // rollupOptions: { + // output: { + // manualChunks(id) { + // if (id.includes('node_modules')) { + // // 让每个插件都打包成独立的文件 + // return id.toString().split('node_modules/')[1].split('/')[0].toString(); + // } + // return null; + // }, + // }, + // }, + terserOptions: { + compress: { + // 生产环境移除console + drop_console: true, + drop_debugger: true, + }, + }, }, - }, });