From a9172b0e15e2b9322b2488afbb1e9e63292d9fe0 Mon Sep 17 00:00:00 2001 From: zernonia Date: Tue, 19 Sep 2023 12:50:14 +0800 Subject: [PATCH] refactor: use lodash templates --- packages/cli/src/commands/init.ts | 4 ++-- packages/cli/src/utils/templates.ts | 17 +++++++++++++---- pnpm-lock.yaml | 5 +++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index f7f08cf4..594ff177 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -236,8 +236,8 @@ export async function runInit(cwd: string, config: Config) { await fs.writeFile( config.resolvedPaths.tailwindConfig, config.tailwind.cssVariables - ? template(templates.TAILWIND_CONFIG_WITH_VARIABLES)({ extension }) - : template(templates.TAILWIND_CONFIG)({ extension }), + ? template(templates.TAILWIND_CONFIG_WITH_VARIABLES)({ extension, framework: config.framework }) + : template(templates.TAILWIND_CONFIG)({ extension, framework: config.framework }), 'utf8', ) diff --git a/packages/cli/src/utils/templates.ts b/packages/cli/src/utils/templates.ts index 3ddd2206..a1420aa8 100644 --- a/packages/cli/src/utils/templates.ts +++ b/packages/cli/src/utils/templates.ts @@ -65,12 +65,21 @@ module.exports = { export const TAILWIND_CONFIG_WITH_VARIABLES = `/** @type {import('tailwindcss').Config} */ module.exports = { darkMode: ["class"], + <% if (framework === 'vite') { %> content: [ - './pages/**/*.{<%- extension %>,<%- extension %>x}', - './components/**/*.{<%- extension %>,<%- extension %>x}', - './app/**/*.{<%- extension %>,<%- extension %>x}', - './src/**/*.{<%- extension %>,<%- extension %>x}', + './pages/**/*.{<%- extension %>,<%- extension %>x,vue}', + './components/**/*.{<%- extension %>,<%- extension %>x,vue}', + './app/**/*.{<%- extension %>,<%- extension %>x,vue}', + './src/**/*.{<%- extension %>,<%- extension %>x,vue}', ], + <% } else if (framework === 'laravel') { %> + content: [ + "./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php", + "./storage/framework/views/*.php", + "./resources/views/**/*.blade.php", + "./resources/js/**/*.{<%- extension %>,<%- extension %>x,vue}", + ], + <% } %> theme: { container: { center: true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5692994c..d2786682 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2554,6 +2554,7 @@ packages: dependencies: is-glob: 4.0.3 micromatch: 4.0.5 + napi-wasm: 1.1.0 dev: true bundledDependencies: - napi-wasm @@ -8634,6 +8635,10 @@ packages: hasBin: true dev: true + /napi-wasm@1.1.0: + resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==} + dev: true + /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true