Skip to content
This repository was archived by the owner on May 8, 2021. It is now read-only.

Commit 7015d1e

Browse files
committedNov 5, 2019
Update Next.js example
1 parent 6caaa7a commit 7015d1e

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed
 

Diff for: ‎examples/nextjs/README.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,27 @@ module.exports = {
1818
}
1919
```
2020

21-
Next, create a CSS file in your `static` folder for your Tailwind styles. We've used `static/css/tailwind.css` for this example:
21+
Next, create a CSS file for your Tailwind styles. We've used `css/tailwind.css` for this example:
2222

2323
```css
2424
@import "tailwindcss/base";
2525
@import "tailwindcss/components";
2626
@import "tailwindcss/utilities";
2727
```
2828

29-
Finally, import your CSS in your main layout component. Here we're using `components/Layout.js`:
29+
Finally, import your CSS in your `_app.js` component to make them available globally:
3030

3131
```jsx
32-
import '../static/css/tailwind.css'
32+
import React from 'react'
33+
import App from 'next/app'
34+
import '../css/tailwind.css'
35+
36+
class MyApp extends App {
37+
render() {
38+
const { Component, pageProps } = this.props
39+
return <Component {...pageProps} />
40+
}
41+
}
3342

34-
export default ({ children }) => (
35-
<div>
36-
// ...
37-
</div>
38-
)
43+
export default MyApp
44+
```

Diff for: ‎examples/nextjs/components/Layout.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import '../static/css/tailwind.css'
2-
31
export default ({ children }) => {
42
return (
53
<div className="antialiased text-gray-900 flex items-center justify-center min-h-screen">
File renamed without changes.

Diff for: ‎examples/nextjs/pages/_app.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import App from 'next/app'
3+
import '../css/tailwind.css'
4+
5+
class MyApp extends App {
6+
render() {
7+
const { Component, pageProps } = this.props
8+
return <Component {...pageProps} />
9+
}
10+
}
11+
12+
export default MyApp

0 commit comments

Comments
 (0)
This repository has been archived.