-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
3,307 additions
and
1,398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
</template> | ||
|
||
<script setup> | ||
</script> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { defineNuxtModule, addTemplate, updateTemplates } from '@nuxt/kit' | ||
import { resolve } from 'pathe' | ||
import loadConfig from 'tailwindcss/loadConfig.js' | ||
import resolveConfig from 'tailwindcss/resolveConfig.js' | ||
|
||
export default defineNuxtModule({ | ||
setup (_options, nuxt) { | ||
// logger.info('Creating test-tailwind.config.cjs...') | ||
let counter = 1 | ||
|
||
nuxt.hook('tailwindcss:resolvedConfig', (config, oldConfig) => | ||
oldConfig | ||
? setTimeout(() => updateTemplates({ filter: t => t.filename === 'resolved-config.cjs' }), 100) | ||
: addTemplate({ | ||
filename: 'resolved-config.cjs', | ||
getContents: () => `module.exports = /* ${counter++}, ${Boolean(oldConfig)} */ ${JSON.stringify(config, null, 2)}`, | ||
write: true | ||
}) | ||
) | ||
|
||
// const template = addTemplate({ | ||
// filename: 'resolved-config.config.cjs', // gets prepended by .nuxt/ | ||
// getContents: ({ nuxt }) => { | ||
// const config = loadConfig(resolve(nuxt.options.buildDir, 'tailwind.config.cjs')) | ||
// return `module.exports = ${JSON.stringify(resolveConfig(config), null, 2)}` | ||
// }, | ||
// write: true | ||
// }) | ||
|
||
// nuxt.hook('app:templatesGenerated', (_app, templates) => { | ||
// templates.map(t => t.dst).includes(resolve(nuxt.options.buildDir, 'tailwind.config.cjs')) && updateTemplates({ filter: t => t.dst === template.dst }) | ||
// }) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { defineNuxtModule, addTemplate } from '@nuxt/kit' | ||
|
||
export default defineNuxtModule((_, nuxt) => { | ||
const template = addTemplate({ | ||
filename: 'my-tw-config.cjs', | ||
write: true, | ||
getContents: () => ` | ||
const colors = require('tailwindcss/colors') | ||
module.exports = { | ||
theme: { | ||
extend: { | ||
colors: { | ||
accent: colors.slate['500'] | ||
} | ||
} | ||
} | ||
} | ||
` | ||
}) | ||
|
||
nuxt.options.tailwindcss = nuxt.options.tailwindcss ?? {} | ||
if (!Array.isArray(nuxt.options.tailwindcss.configPath)) { | ||
nuxt.options.tailwindcss.configPath = nuxt.options.tailwindcss.configPath ? [nuxt.options.tailwindcss.configPath] : ['tailwind.config'] | ||
} | ||
nuxt.options.tailwindcss.configPath.push(template.dst) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.