From 2c7692ddc31442d277ba9421c0e43fd112fa3070 Mon Sep 17 00:00:00 2001 From: ningmengchongshui <916415899@qq.com> Date: Sun, 16 Jun 2024 11:29:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- image/tailwindcss.ts | 22 ++++++++++++++++++++-- package.json | 3 ++- tailwind.config.js | 17 ++++++++++++----- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/image/tailwindcss.ts b/image/tailwindcss.ts index eb00dc3..96c76db 100644 --- a/image/tailwindcss.ts +++ b/image/tailwindcss.ts @@ -1,7 +1,25 @@ -import { exec } from 'child_process' +import { spawn } from 'child_process' /** * ********** * 生成css文件 * ********** */ -exec('tailwindcss -i ./src/input.css -o ./public/output.css --watch') +// exec('') + +const child = spawn( + 'tailwindcss -i ./src/input.css -o ./public/output.css --watch', + [], + { + shell: true, + stdio: 'inherit' + } +) +/** + * ************* + * exit + * ************* + */ +process.on('SIGINT', () => { + if (child.pid) process.kill(child.pid) + if (process.pid) process.exit() +}) diff --git a/package.json b/package.json index 9bf9540..8a84a9f 100644 --- a/package.json +++ b/package.json @@ -55,12 +55,12 @@ "@rollup/plugin-typescript": "^11.1.3", "@types/inquirer": "^9.0.7", "@types/koa": "^2.15.0", + "@types/koa-mount": "^4.0.5", "@types/koa-router": "^7.4.8", "@types/koa-static": "^4.0.4", "@types/lodash": "^4.14.200", "@types/node": "^20.8.5", "@types/node-schedule": "^2.1.7", - "@types/koa-mount": "^4.0.5", "@types/react-dom": "^18.2.22", "@types/redis": "^4.0.11", "@types/ws": "^8.5.7", @@ -74,6 +74,7 @@ "koa-router": "^12.0.1", "koa-static": "^5.0.0", "nodemon": "^3.0.1", + "preline": "^2.3.0", "prettier": "^3.0.3", "rollup": "^4.16.4", "tailwindcss": "^3.4.3", diff --git a/tailwind.config.js b/tailwind.config.js index 8e308fd..11ef9ca 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,10 +1,17 @@ +import { createRequire } from 'module' +const require = createRequire(import.meta.url) /** * @type {import('tailwindcss').Config} */ export default { - content: ['./plugins/**/*.{jsx,tsx}', './example/**/*.{jsx,tsx}'], - theme: { - extend: {} - }, - plugins: [] + /** + * 仅对plugins目录下的jsx、tsx、html文件生效 + */ + content: ['./plugins/**/*.{jsx,tsx,html}'], + /** + * 并不加入preline的js逻辑 + * 需要开发并使用js交互效果 + * 请自行建立独立的web环境 + */ + plugins: [require('preline/plugin')] }