Skip to content

Commit

Permalink
feat: Adding Tailwind Viewer to Nuxt dev tools (#612)
Browse files Browse the repository at this point in the history
* feat: tailwindcss viewer in devtools

* refactor: ts missing error
  • Loading branch information
claranceliberi committed Feb 11, 2023
1 parent 0c5e073 commit c46c834
Show file tree
Hide file tree
Showing 4 changed files with 424 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -45,6 +45,7 @@
"devDependencies": {
"@fontsource/inter": "^4.5.15",
"@nuxt/content": "^2.4.0",
"@nuxt/devtools": "^0.1.0",
"@nuxt/module-builder": "latest",
"@nuxt/test-utils": "^3.1.1",
"@nuxtjs/eslint-config-typescript": "latest",
Expand Down
3 changes: 2 additions & 1 deletion playground/nuxt.config.ts
Expand Up @@ -2,7 +2,8 @@ export default defineNuxtConfig({
extends: ['./theme'],
modules: [
'@nuxt/content',
'../src/module'
'../src/module',
'@nuxt/devtools'
],
tailwindcss: {
exposeConfig: true,
Expand Down
16 changes: 16 additions & 0 deletions src/module.ts
Expand Up @@ -314,5 +314,21 @@ export default defineNuxtModule<ModuleOptions>({
logger.info(`Tailwind Viewer: ${chalk.underline.yellow(withTrailingSlash(viewerUrl))}`)
})
}

if (nuxt.options.dev) {
// @ts-expect-error missing type
nuxt.hook('devtools:customTabs', (tabs) => {
tabs.push({
title: 'TailwindCSS',
name: 'tailwindcss',
icon: 'logos-tailwindcss-icon',
view: {
type: 'iframe',
src: '/_tailwind/'
}
})
})
}
}

})

0 comments on commit c46c834

Please sign in to comment.