Skip to content

docs: update nuxt 2.15 & tailwindcss 2.x with typography & dark-mode example #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ebd19eb
docs: update how to release to tailwind 2
atinux Nov 19, 2020
aac9939
chore(deps): update dependency @nuxt/content-theme-docs to ^0.8.1 (#204)
renovate[bot] Nov 19, 2020
f0a699a
chore(deps): update all non-major dependencies (#205)
renovate[bot] Nov 26, 2020
52cbf0c
docs: update tailwindcss v2 compat dependencies (#209)
benjamincanac Nov 26, 2020
43db226
feat: add tailwind colors page (#215)
atinux Dec 2, 2020
d1e5ecb
chore(release): 3.3.0
atinux Dec 2, 2020
850f863
chore(deps): update devdependency nuxt to ^2.14.9 (#214)
renovate[bot] Dec 3, 2020
6058ea8
fix: handle color as string and smarted light/dark detection
atinux Dec 3, 2020
087aef1
docs: improvements
atinux Dec 3, 2020
df9970f
chore(release): 3.3.1
atinux Dec 3, 2020
431eafc
fix(lib): check listeners value before
atinux Dec 4, 2020
87b3a6c
chore(deps): update devdependency eslint-plugin-vue to ^7.2.0 (#219)
renovate[bot] Dec 4, 2020
8ea24c6
docs: update tailwind v2 using yarn
atinux Dec 4, 2020
bcfd2cc
chore(release): 3.3.2
atinux Dec 4, 2020
15e1c43
docs: fix minor typo (#217)
azrikahar Dec 4, 2020
c84c8be
Remove duplicated border-2 class from copy-box (#221)
mattycraig Dec 4, 2020
9a3ebc2
chore(release): 3.3.3
atinux Dec 4, 2020
b18380d
fix: addTemplate call compats low version nuxt (#225)
zcqno1 Dec 11, 2020
4641a90
chore(deps): update all non-major dependencies (#222)
renovate[bot] Dec 11, 2020
956fcc8
chore(release): 3.3.4
atinux Dec 11, 2020
a76bf9e
chore(deps): update devdependency husky to ^4.3.6 (#230)
renovate[bot] Dec 14, 2020
cc7534c
chore(deps): update actions/setup-node action to v2 (#234)
renovate[bot] Dec 17, 2020
954b54c
chore(deps): update all non-major dependencies (#233)
renovate[bot] Dec 17, 2020
cc9fb3f
feat: integrate tailwind-config-viewer (#232)
rogden Dec 17, 2020
ed76e04
chore(release): 3.4.0
atinux Dec 17, 2020
f35b1cc
fix(middleware): use cjs syntax (#236)
pi0 Dec 18, 2020
22c7f26
chore(release): 3.4.1
atinux Dec 18, 2020
c18498f
chore(deps): update all non-major dependencies (#237)
renovate[bot] Dec 22, 2020
f797eb8
chore(release): 3.4.2
atinux Dec 22, 2020
dc2fa87
docs: add postcss plugin example
atinux Dec 22, 2020
f9c5f59
chore: copywriting
atinux Dec 22, 2020
70b2be1
docs: fix spelling and grammar in setup (#241)
axieum Jan 7, 2021
f5022b7
chore(deps): update all non-major dependencies (#238)
renovate[bot] Jan 14, 2021
b193d5e
docs: move to docus
atinux Jan 19, 2021
4e120e7
docs: add whitelist section to purge (#250)
Geminii Jan 25, 2021
2c498bc
feat: upgrade to TailwindCSS 2
atinux Nov 19, 2020
2b180bb
chore(deps): force node 12.3.0 minimum
atinux Nov 19, 2020
0f1aa42
fix: add forms, typography & aspect-ratio plugins
vinayakkulkarni Jan 11, 2021
07b9799
chore(deps): add required dependencies for tailwind v2
vinayakkulkarni Jan 11, 2021
e2839ca
chore: update contributors to be more verbose ;)
vinayakkulkarni Jan 11, 2021
32f5f90
docs: add dark mode from tailwindcss v2
vinayakkulkarni Jan 11, 2021
c40ad18
docs: remove forms, typography & aspect-ratio plugins
vinayakkulkarni Feb 16, 2021
2dfef45
chore: delete dark typography demo
vinayakkulkarni Feb 16, 2021
6c7a53c
docs: refactor documentation using `docus.dev`
vinayakkulkarni Feb 16, 2021
aa3a102
docs: add example of TailwindUI with Tailwindcss 2
vinayakkulkarni Feb 16, 2021
c116f5b
Merge branch 'feat/tailwindcss2' into docs/update-documentation
vinayakkulkarni Feb 16, 2021
fa22bf6
chore: bump deps
vinayakkulkarni Feb 16, 2021
3ff38d5
chore: remove plugins installed by default
vinayakkulkarni Feb 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
node: [12]

steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,52 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [3.4.2](https://github.com/nuxt-community/tailwindcss-module/compare/v3.4.1...v3.4.2) (2020-12-22)

### [3.4.1](https://github.com/nuxt-community/tailwindcss-module/compare/v3.4.0...v3.4.1) (2020-12-18)


### Bug Fixes

* **middleware:** use cjs syntax ([#236](https://github.com/nuxt-community/tailwindcss-module/issues/236)) ([f35b1cc](https://github.com/nuxt-community/tailwindcss-module/commit/f35b1cc44dc9b3d1ff926b7d377d64c354b3697d))

## [3.4.0](https://github.com/nuxt-community/tailwindcss-module/compare/v3.3.4...v3.4.0) (2020-12-17)


### Features

* integrate tailwind-config-viewer ([#232](https://github.com/nuxt-community/tailwindcss-module/issues/232)) ([cc9fb3f](https://github.com/nuxt-community/tailwindcss-module/commit/cc9fb3f9b793fb7a3a931059ab20388130e137df))

### [3.3.4](https://github.com/nuxt-community/tailwindcss-module/compare/v3.3.3...v3.3.4) (2020-12-11)


### Bug Fixes

* addTemplate call compats low version nuxt ([#225](https://github.com/nuxt-community/tailwindcss-module/issues/225)) ([b18380d](https://github.com/nuxt-community/tailwindcss-module/commit/b18380dcd529d679314563f54f66dfe84556767c))

### [3.3.3](https://github.com/nuxt-community/tailwindcss-module/compare/v3.3.2...v3.3.3) (2020-12-04)

### [3.3.2](https://github.com/nuxt-community/tailwindcss-module/compare/v3.3.1...v3.3.2) (2020-12-04)


### Bug Fixes

* **lib:** check listeners value before ([431eafc](https://github.com/nuxt-community/tailwindcss-module/commit/431eafcce286317b0efdc1f4f7de303daaf672c9)), closes [#216](https://github.com/nuxt-community/tailwindcss-module/issues/216)

### [3.3.1](https://github.com/nuxt-community/tailwindcss-module/compare/v3.3.0...v3.3.1) (2020-12-03)


### Bug Fixes

* handle color as string and smarted light/dark detection ([6058ea8](https://github.com/nuxt-community/tailwindcss-module/commit/6058ea81021b2aee33ed3bb8a262352a3b35414a))

## [3.3.0](https://github.com/nuxt-community/tailwindcss-module/compare/v3.2.0...v3.3.0) (2020-12-02)


### Features

* add tailwind colors page ([#215](https://github.com/nuxt-community/tailwindcss-module/issues/215)) ([43db226](https://github.com/nuxt-community/tailwindcss-module/commit/43db226c51bd354ea54bd4638c9da882a1fb9442))

## [3.2.0](https://github.com/nuxt-community/tailwindcss-module/compare/v3.1.0...v3.2.0) (2020-10-22)


Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

## Features

- Zero configuration to start
- PurgeCSS included for minimal CSS
- Use latest CSS features (Stage 1)
- Reference your Tailwind config in your app
- Extendable by Nuxt modules
- 👌  Zero configuration to start *([see video](https://tailwindcss.nuxtjs.org/#quick-start))*
- ⚡️  PurgeCSS included for minimal CSS ⚡️
- 🪄  Use latest CSS features *([Stage 1](https://cssdb.org/#stage-1))*
- 🎨  Discover your Tailwind Colors *([see video](https://tailwindcss.nuxtjs.org/#tailwind-colors))*
- ⚙️  Reference your Tailwind config in your app
- 📦  Extendable by [Nuxt modules](https://modules.nuxtjs.org/)

[📖  Read more](https://tailwindcss.nuxtjs.org)

Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/examples/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Basic Usage Example
menuTitle: Basic Usage
description: 'Live example of basic usage of Nuxt TailwindCSS on CodeSandbox.'
position: 5
position: 6
category: Examples
csb_link: https://codesandbox.io/embed/nuxt-tailwindcss-o4vn5pvp7q
fullscreen: true
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/examples/dark-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Dark Mode Example
menuTitle: Dark Mode
description: 'Live example of dark mode with Nuxt TailwindCSS on CodeSandbox.'
position: 6
position: 7
category: Examples
csb_link: https://codesandbox.io/embed/nuxt-dark-tailwindcss-17g2j
fullscreen: true
Expand Down
13 changes: 13 additions & 0 deletions docs/content/en/examples/postcss-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Example with PostCSS Plugins
menuTitle: PostCSS Plugins
description: 'Live example of Nuxt Tailwind with postcss-nested plugin'
position: 9
category: Examples
csb_link: https://codesandbox.io/embed/postcss-plugin-with-nuxt-tailwind-gyfo8
fullscreen: true
---

Example with [postcss-nested](https://github.com/postcss/postcss-nested) plugin, see [how to add PostCSS plugins](https://nuxtjs.org/faq/postcss-plugins/) in Nuxt.

<code-sandbox :src="csb_link"></code-sandbox>
13 changes: 13 additions & 0 deletions docs/content/en/examples/tailwind2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Tailwind UI Example
menuTitle: Tailwind UI with Tailwind 2
description: 'Live example of Tailwind UI with Typography plugin with Nuxt on CodeSandbox.'
position: 8
category: Examples
csb_link: https://codesandbox.io/embed/tailwind-typography-with-color-mode-4s7i3
fullscreen: true
---

Example with [Tailwind UI](https://tailwindui.com) plugin with the [Typography](https://github.com/tailwindlabs/tailwindcss-typography) plugin & [@nuxt/color-mode](https://color-mode.nuxtjs.org/) module.

<code-sandbox :src="csb_link"></code-sandbox>
4 changes: 3 additions & 1 deletion docs/content/en/examples/tailwindui.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
title: Tailwind UI Example
menuTitle: Tailwind UI
description: 'Live example of Tailwind UI plugin with Nuxt on CodeSandbox.'
position: 7
position: 8
category: Examples
csb_link: https://codesandbox.io/embed/nuxt-tailwindui-xy1jk
fullscreen: true
---

Example with [Tailwind UI](https://tailwindui.com) plugin with the [Inter](https://rsms.me/inter/) font loaded by [@nuxtjs/google-fonts](https://github.com/nuxt-community/google-fonts-module) module.

> Note: Tailwindcss 2.x doesn't require you to have `@tailwind/ui` package installed, checkout the [new demo](/examples/tailwind2) which uses tailwindcss 2.x + tailwindui components

<code-sandbox :src="csb_link"></code-sandbox>
37 changes: 27 additions & 10 deletions docs/content/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,48 @@
title: Introduction
description: 'Add Tailwind CSS to your Nuxt application in seconds.'
position: 1
category: ''
category: 'Getting started'
categoryPosition: 1
features:
- Zero configuration to start
- PurgeCSS included for minimal CSS
- Use latest CSS features (Stage 1)
- Reference your Tailwind config in your app
- Extendable by Nuxt modules
---

<img src="/preview.png" class="light-img" />
<img src="/preview-dark.png" class="dark-img" />

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

<alert type="info">

This module default to Tailwind v1, please look at [these instructions](/setup#tailwind-2) to upgrade to Tailwind v2.

</alert>

## Features

<list :items="features"></list>
- 👌&nbsp; Zero configuration to start
- ⚡️&nbsp; PurgeCSS included for minimal CSS ⚡️
- 🪄&nbsp; Use latest CSS features *([Stage 1](https://cssdb.org/#stage-1))*
- 🎨&nbsp; Discover your Tailwind configuration *([see video](/#tailwind-colors))*
- 📦&nbsp; Extendable by [Nuxt modules](https://modules.nuxtjs.org/)
- ⚙️&nbsp; Reference your Tailwind config in your app

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

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

## Video
### Quick start

<video poster="https://res.cloudinary.com/nuxt/video/upload/v1596625297/nuxt-tailwindcss_ipv0ta.jpg" loop playsinline controls>
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1596625297/nuxt-tailwindcss_ipv0ta.webm" type="video/webm" />
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1596625297/nuxt-tailwindcss_ipv0ta.mp4" type="video/mp4" />
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1596625297/nuxt-tailwindcss_ipv0ta.ogv" type="video/ogg" />
</video>

### Tailwind Viewer

<video poster="https://res.cloudinary.com/nuxt/video/upload/v1608225750/nuxt-tailwind-viewer_ktowjm.jpg" loop playsinline controls>
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.webm" type="video/webm" />
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.mp4" type="video/mp4" />
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.ogv" type="video/ogg" />
</video>

Learn more about the [Tailwind viewer](/tailwind-viewer).
28 changes: 25 additions & 3 deletions docs/content/en/options.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
title: Options
description: 'You can configure the module easily with the tailwindcss property.'
position: 4
category: Guide
categoryPosition: 2
position: 3
category: Getting started
---

You can configure the module by using the `tailwindcss` property in the `nuxt.config.js`:
Expand Down Expand Up @@ -101,3 +100,26 @@ export default {
```

Learn more about overwriting Tailwind config [here](/tailwind-config).

## `viewer`

- Default: `true` in development
- Version: <badge>v3.4+</badge>

<alert type="info">

The [Tailwind viewer](/tailwind-viewer) is only available in development with `nuxt dev`.

</alert>

The module internally use [tailwind-config-viewer](https://github.com/rogden/tailwind-config-viewer) to setup the `/_tailwind/` route.

To disable the viewer in development, set it to `false`:

```js{}[nuxt.config.js]
export default {
tailwindcss: {
viewer: false
}
}
```
29 changes: 27 additions & 2 deletions docs/content/en/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Setup
description: 'Using TailwindCSS in your Nuxt project is only one command away'
position: 2
category: Guide
category: Getting started
---

Using TailwindCSS in your Nuxt project is only one command away ✨
Expand Down Expand Up @@ -44,6 +44,12 @@ That's it! You can now use Tailwind classes in your Nuxt app ✨

</alert>

<alert type="info">

Discover your color palette based on your Tailwind config on `/_tailwind` route.

</alert>

## Tailwind Files

When running `nuxt dev`, this module will look for these two files:
Expand Down Expand Up @@ -77,8 +83,27 @@ See the [module options](/options).

## Upgrading Tailwind

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.
### Tailwind 2

Nuxt 2.14 is still using PostCSS 7, we have a [pull request](https://github.com/nuxt/nuxt.js/pull/8346) opened to upgrade the dependencies. Once merged on `v2.15`, we will release a major version of this module to include TailwindCSS 2, see [PR#203](https://github.com/nuxt-community/tailwindcss-module/pull/203).

In the meantime, you can upgrade Tailwind by using the [compatibility build](https://tailwindcss.com/docs/installation#post-css-7-compatibility-build):

```bash
yarn add --dev tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
```

Please ensure you are using `Node >= 12.13.0` in order to use version 2 of TailwindCSS.

<alert type="warning">

We have seen an issue with NPM regarding the packages resolution (see [comment](https://github.com/nuxt-community/tailwindcss-module/issues/202#issuecomment-738442349)), we highly recommend using [Yarn V1](https://classic.yarnpkg.com/en/docs/install) when working with Nuxt 2.

</alert>

### Tailwind 1

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.

<code-group>
<code-block label="Yarn" active>
Expand Down
22 changes: 19 additions & 3 deletions docs/content/en/tailwind-config.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Tailwind Config
description: 'You can configure the integration easily with the storybook property.'
position: 3
position: 4
category: Guide
---

`@nuxtjs/tailwindcss` configures the Tailwind configuration to have the best user experience as possible by default.

## Default Configuration

```js
```js{}[tailwind.config.js]
{
theme: {},
variants: {},
Expand Down Expand Up @@ -79,7 +79,7 @@ Learn more about the [Tailwind config](https://tailwindcss.com/docs/configuratio

You can also use your `nuxt.config.js` to set your Tailwind Config with the `tailwindcss.config` property:

```js{}[nuxt.config.js]
```js [nuxt.config.js]
import tailwindTypography from '@tailwindcss/typography'

export default {
Expand Down Expand Up @@ -186,6 +186,22 @@ This merging strategy of with a function only applies to `plugins` and `purge.co

</alert>

### Whitelisting classes

If you need to whitelisting classes and avoid purge system, you need to precise `safelist` option like below :

```js{}[tailwind.config.js]
module.exports = {
purge: {
options: {
// Whitelisting some classes to avoid purge
safelist: ['whitelisted']
}
}
}
```


## Referencing in the application

It can often be useful to reference tailwind configuration values in runtime. For example to access some of your theme values when dynamically applying inline styles in a component.
Expand Down
23 changes: 23 additions & 0 deletions docs/content/en/tailwind-viewer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Tailwind Viewer
description: 'Visualize your Tailwind configuration with the viewer.'
position: 5
category: Guide
categoryPosition: 2
---

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 ✨

The viewer is available from the `v3.4.0` of `@nuxtjs/tailwindcss`.

<video poster="https://res.cloudinary.com/nuxt/video/upload/v1608225750/nuxt-tailwind-viewer_ktowjm.jpg" loop playsinline controls>
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.webm" type="video/webm" />
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.mp4" type="video/mp4" />
<source src="https://res.cloudinary.com/nuxt/video/upload/q_auto/v1608225750/nuxt-tailwind-viewer_ktowjm.ogv" type="video/ogg" />
</video>

When enabled, you will see the Tailwind viewer url in your terminal:

<img src="/tailwind-viewer.png" width="530" height="246" style="margin: 0;" />

Checkout the [viewer option](/options#viewer) to disable the viewer in development.
10 changes: 7 additions & 3 deletions docs/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import theme from '@nuxt/content-theme-docs'
import { withDocus } from 'docus'

export default theme({
export default withDocus({
env: {
GITHUB_TOKEN: process.env.GITHUB_TOKEN
},
loading: { color: '#38b2ac' },
docus: {
colors: {
primary: '#38b2ac'
}
},
buildModules: [
// https://github.com/bdrtsky/nuxt-ackee
'nuxt-ackee'
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"license": "MIT",
"homepage": "https://tailwindcss.nuxtjs.org",
"dependencies": {
"@nuxt/content-theme-docs": "^0.7.2",
"nuxt": "^2.14.7"
"docus": "^0.0.8",
"nuxt": "^2.15.0"
},
"devDependencies": {
"nuxt-ackee": "^2.0.0"
Expand Down
Binary file added docs/static/tailwind-viewer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading