Skip to content

Commit cc9fb3f

Browse files
rogdenatinux
andauthored
feat: integrate tailwind-config-viewer (#232)
* feat: integrate tailwind-config-viewer * feat: add viewer option and only run viewer in dev mode * chore: improvements * chore: ignore code for dev * docs: add viewer * docs: add video * chore: ignore serverMiddleware * chore: fix yarn.lock Co-authored-by: Sébastien Chopin <[email protected]>
1 parent 954b54c commit cc9fb3f

File tree

17 files changed

+1427
-1670
lines changed

17 files changed

+1427
-1670
lines changed

docs/content/en/examples/basic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Basic Usage Example
33
menuTitle: Basic Usage
44
description: 'Live example of basic usage of Nuxt TailwindCSS on CodeSandbox.'
5-
position: 5
5+
position: 6
66
category: Examples
77
csb_link: https://codesandbox.io/embed/nuxt-tailwindcss-o4vn5pvp7q
88
fullscreen: true

docs/content/en/examples/dark-mode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Dark Mode Example
33
menuTitle: Dark Mode
44
description: 'Live example of dark mode with Nuxt TailwindCSS on CodeSandbox.'
5-
position: 6
5+
position: 7
66
category: Examples
77
csb_link: https://codesandbox.io/embed/nuxt-dark-tailwindcss-17g2j
88
fullscreen: true

docs/content/en/examples/tailwindui.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Tailwind UI Example
33
menuTitle: Tailwind UI
44
description: 'Live example of Tailwind UI plugin with Nuxt on CodeSandbox.'
5-
position: 7
5+
position: 8
66
category: Examples
77
csb_link: https://codesandbox.io/embed/nuxt-tailwindui-xy1jk
88
fullscreen: true

docs/content/en/index.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@ categoryPosition: 1
1111

1212
Add [Tailwind CSS](https://tailwindcss.com) to your [Nuxt](https://nuxtjs.org) application in seconds.
1313

14+
<alert type="info">
15+
16+
This module default to Tailwind v1, please look at [these instructions](/setup#tailwind-2) to upgrade to Tailwind v2.
17+
18+
</alert>
19+
1420
## Features
1521

1622
- 👌&nbsp; Zero configuration to start
1723
- ⚡️&nbsp; PurgeCSS included for minimal CSS ⚡️
1824
- 🪄&nbsp; Use latest CSS features *([Stage 1](https://cssdb.org/#stage-1))*
19-
- 🎨&nbsp; Discover your Tailwind Colors *([see video](/#tailwind-colors))*
20-
- ⚙️&nbsp; Reference your Tailwind config in your app
25+
- 🎨&nbsp; Discover your Tailwind configuration *([see video](/#tailwind-colors))*
2126
- 📦&nbsp; Extendable by [Nuxt modules](https://modules.nuxtjs.org/)
27+
- ⚙️&nbsp; Reference your Tailwind config in your app
2228

2329
<p class="flex items-center">Enjoy a documentation with light and dark mode:&nbsp;<app-color-switcher class="flex"></app-color-switcher></p>
2430

@@ -32,10 +38,12 @@ Add [Tailwind CSS](https://tailwindcss.com) to your [Nuxt](https://nuxtjs.org) a
3238
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1596625297/nuxt-tailwindcss_ipv0ta.ogv" type="video/ogg" />
3339
</video>
3440

35-
### Tailwind Colors
41+
### Tailwind Viewer
3642

37-
<video poster="https://res.cloudinary.com/nuxt/video/upload/v1606994332/nuxt-tailwind-colors_qlio2t.jpg" loop playsinline controls>
38-
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1606994332/nuxt-tailwind-colors_qlio2t.webm" type="video/webm" />
39-
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1606994332/nuxt-tailwind-colors_qlio2t.mp4" type="video/mp4" />
40-
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1606994332/nuxt-tailwind-colors_qlio2t.ogv" type="video/ogg" />
43+
<video poster="https://res.cloudinary.com/nuxt/video/upload/v1608225750/nuxt-tailwind-viewer_ktowjm.jpg" loop playsinline controls>
44+
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.webm" type="video/webm" />
45+
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.mp4" type="video/mp4" />
46+
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.ogv" type="video/ogg" />
4147
</video>
48+
49+
Learn more about the [Tailwind viewer](/tailwind-viewer).

docs/content/en/options.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Options
33
description: 'You can configure the module easily with the tailwindcss property.'
4-
position: 4
4+
position: 5
55
category: Guide
66
categoryPosition: 2
77
---
@@ -101,3 +101,26 @@ export default {
101101
```
102102

103103
Learn more about overwriting Tailwind config [here](/tailwind-config).
104+
105+
## `viewer`
106+
107+
- Default: `true` in development
108+
- Version: <badge>v3.4+</badge>
109+
110+
<alert type="info">
111+
112+
The [Tailwind viewer](/tailwind-viewer) is only available in development with `nuxt dev`.
113+
114+
</alert>
115+
116+
The module internally use [tailwind-config-viewer](https://github.com/rogden/tailwind-config-viewer) to setup the `/_tailwind/` route.
117+
118+
To disable the viewer in development, set it to `false`:
119+
120+
```js{}[nuxt.config.js]
121+
export default {
122+
tailwindcss: {
123+
viewer: false
124+
}
125+
}
126+
```

docs/content/en/setup.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ We have seen an issue with NPM regarding the packages resolution (see [comment](
101101

102102
</alert>
103103

104-
105104
### Tailwind 1
106105

107106
When a new version of Tailwind CSS is released, you don't need to wait for this module to upgrade, you can directly upgrade your dependencies.

docs/content/en/tailwind-viewer.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Tailwind Viewer
3+
description: 'Visualize your Tailwind configuration with the viewer.'
4+
position: 4
5+
category: Guide
6+
categoryPosition: 2
7+
---
8+
9+
Nuxt Tailwind will expose a `/_tailwind/` route in development so you can quickly visualize your tailwind configuration with easy copy pasting, thanks to the awesome [tailwind-config-viewer](https://github.com/rogden/tailwind-config-viewer) package ✨
10+
11+
The viewer is available from the `v3.4.0` of `@nuxtjs/tailwindcss`.
12+
13+
<video poster="https://res.cloudinary.com/nuxt/video/upload/v1608225750/nuxt-tailwind-viewer_ktowjm.jpg" loop playsinline controls>
14+
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.webm" type="video/webm" />
15+
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.mp4" type="video/mp4" />
16+
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.ogv" type="video/ogg" />
17+
</video>
18+
19+
When enabled, you will see the Tailwind viewer url in your terminal:
20+
21+
<img src="/tailwind-viewer.png" width="530" height="246" style="margin: 0;" />
22+
23+
Checkout the [viewer option](/options#viewer) to disable the viewer in development.

docs/static/tailwind-viewer.png

29.2 KB
Loading

0 commit comments

Comments
 (0)