teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

5

タグ追加

2021/06/30 08:06

投稿

asano0313
asano0313

スコア2

title CHANGED
File without changes
body CHANGED
File without changes

4

情報追加

2021/06/30 08:06

投稿

asano0313
asano0313

スコア2

title CHANGED
File without changes
body CHANGED
@@ -24,4 +24,78 @@
24
24
  important: true,
25
25
  }
26
26
 
27
+ ```
28
+
29
+ 情報追加
30
+ _app.tsx
31
+ ```typescript
32
+ import React from "react"
33
+ import Head from "next/head"
34
+ import { AppProps } from "next/app"
35
+ import { ThemeProvider } from "@material-ui/core/styles"
36
+ import CssBaseline from "@material-ui/core/CssBaseline"
37
+ import theme from "../components/utils/theme"
38
+ import '../styles/tailwind.css'
39
+
40
+ export default function MyApp({ Component, pageProps }: AppProps) {
41
+
42
+ return (
43
+ <React.Fragment>
44
+ <Head>
45
+ <title></title>
46
+ <meta
47
+ name="viewport"
48
+ content="minimum-scale=1, initial-scale=1, width=device-width"
49
+ />
50
+ </Head>
51
+ <ThemeProvider theme={theme}>
52
+ {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
53
+ <CssBaseline />
54
+ <Component {...pageProps} />
55
+ </ThemeProvider>
56
+ </React.Fragment>
57
+ )
58
+ }
59
+ ```
60
+ _documents.tsx
61
+ ```typescript
62
+ import React from "react"
63
+ import Document, { Head, Html, Main, NextScript } from "next/document"
64
+ import { ServerStyleSheets } from "@material-ui/core/styles"
65
+ import theme from "../components/utils/theme"
66
+
67
+ export default class MyDocument extends Document {
68
+ render() {
69
+ return (
70
+ <Html lang="ja-JP">
71
+ <Head>
72
+ {/* PWA primary color */}
73
+ <meta name="theme-color" content={theme.palette.primary.main} />
74
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
75
+ </Head>
76
+ <body>
77
+ <Main />
78
+ <NextScript />
79
+ </body>
80
+ </Html>
81
+ )
82
+ }
83
+ }
84
+
85
+ MyDocument.getInitialProps = async (ctx) => {
86
+ const sheets = new ServerStyleSheets()
87
+ const originalRenderPage = ctx.renderPage
88
+
89
+ ctx.renderPage = () =>
90
+ originalRenderPage({
91
+ enhanceApp: (App) => (props) => sheets.collect(<App {...props} />)
92
+ })
93
+
94
+ const initialProps = await Document.getInitialProps(ctx)
95
+
96
+ return {
97
+ ...initialProps,
98
+ styles: [...React.Children.toArray(initialProps.styles), sheets.getStyleElement()]
99
+ }
100
+ }
27
101
  ```

3

typo

2021/06/30 07:42

投稿

asano0313
asano0313

スコア2

title CHANGED
@@ -1,1 +1,1 @@
1
- デプロイ時にTailwind css 機能しない
1
+ デプロイ時にTailwind css 機能しない
body CHANGED
File without changes

2

tailwind.confug.js

2021/06/30 07:39

投稿

asano0313
asano0313

スコア2

title CHANGED
File without changes
body CHANGED
@@ -5,4 +5,23 @@
5
5
 
6
6
  正しい表示(localhost)
7
7
  ![イメージ説明](d1d683f9186e8074a3f0224f2c99bf98.png)
8
- 分かる方がいたらご教授いただければ幸いです。
8
+ 分かる方がいたらご教授いただければ幸いです。
9
+
10
+
11
+ tailwind.confug.js
12
+ ```
13
+ module.exports = {
14
+ mode: 'jit',
15
+ purge: ['./src/**/*.{js,jsx,ts,tsx}'],
16
+ darkMode: false, // or 'media' or 'class'
17
+ theme: {
18
+ extend: {},
19
+ },
20
+ variants: {
21
+ extend: {},
22
+ },
23
+ plugins: [],
24
+ important: true,
25
+ }
26
+
27
+ ```

1

画像追加

2021/06/30 07:31

投稿

asano0313
asano0313

スコア2

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,8 @@
1
1
  cloudfrontにデプロイ後tailwind cssが機能しません。(Next.jsを使っています)
2
+
2
3
  ~.cloudfront.net/index.htmlにアクセス後の画面
3
4
  ![イメージ説明](f062d42a5bd47dc95485764971299e24.png)
5
+
6
+ 正しい表示(localhost)
7
+ ![イメージ説明](d1d683f9186e8074a3f0224f2c99bf98.png)
4
8
  分かる方がいたらご教授いただければ幸いです。