Skip to content

Commit

Permalink
feat: tailwindcss config typescript template
Browse files Browse the repository at this point in the history
  • Loading branch information
adhamfarrag committed Jan 23, 2024
1 parent e23265d commit c6e4a1b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/commands/CSS.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { window } from 'vscode'
import { unoCSSConfig, windiCSSConfig, tailwindCSSFile, tailwindCSSConfig, vuetifyConfigFile } from '../templates'
import { isNuxtTwo, createFile, projectSrcDirectory, runCommand, openExternalLink, addNuxtModule, getInstallationCommand } from '../utils'
import { unoCSSConfig, windiCSSConfig, tailwindCSSFile, tailwindCSSJSConfig, tailwindCSSTSConfig, vuetifyConfigFile } from '../templates'
import { isNuxtTwo, createFile, projectSrcDirectory, runCommand, openExternalLink, addNuxtModule, getInstallationCommand, projectRootDirectory } from '../utils'

const frameworks = ['TailwindCSS', 'WindiCSS', 'UnoCSS', 'Vuetify']

Expand Down Expand Up @@ -80,10 +80,11 @@ const configureTailwind = () => {
}

if (selections.includes(TailwindOptions.createConfigFile)) {

await createFile({
fileName: `tailwind.config.${isNuxtTwo() ? 'js' : 'ts'}`,
content: tailwindCSSConfig,
fullPath: `${await projectSrcDirectory()}/tailwind.config.js`,
content: isNuxtTwo() ? tailwindCSSJSConfig : tailwindCSSTSConfig,
fullPath: `${projectRootDirectory()}/tailwind.config.${isNuxtTwo() ? 'js' : 'ts'}`,
})
}

Expand Down
17 changes: 15 additions & 2 deletions src/templates/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
})
`

const tailwindCSSConfig = `/** @type {import('tailwindcss').Config} */
const tailwindCSSJSConfig = `/** @type {import('tailwindcss').Config} */
module.exports = {
content: [],
theme: {
Expand All @@ -22,6 +22,18 @@ module.exports = {
}
`

const tailwindCSSTSConfig = `import type { Config } from 'tailwindcss'
export default <Partial<Config>> {
content: [],
theme: {
extend: {
}
},
plugins: []
}
`

const tailwindCSSFile = `@tailwind base;
@tailwind components;
@tailwind utilities;`
Expand All @@ -39,7 +51,8 @@ export default {
export {
unoCSSConfig,
windiCSSConfig,
tailwindCSSConfig,
tailwindCSSJSConfig,
tailwindCSSTSConfig,
tailwindCSSFile,
vuetifyConfigFile
}
5 changes: 3 additions & 2 deletions src/templates/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { eslintConfig, stylelintConfig, stylelintIgnore, eslintIgnore } from './linters'
import { unoCSSConfig, windiCSSConfig, tailwindCSSConfig, tailwindCSSFile, vuetifyConfigFile } from './css'
import { unoCSSConfig, windiCSSConfig, tailwindCSSJSConfig, tailwindCSSTSConfig, tailwindCSSFile, vuetifyConfigFile } from './css'
import {
nitroDefaultTemplate,
nuxtMiddlewareTemplate,
Expand All @@ -17,7 +17,8 @@ import { appConfigContent } from './appConfig'
export {
unoCSSConfig,
windiCSSConfig,
tailwindCSSConfig,
tailwindCSSJSConfig,
tailwindCSSTSConfig,
tailwindCSSFile,
vuetifyConfigFile,
eslintConfig,
Expand Down

0 comments on commit c6e4a1b

Please sign in to comment.