質問編集履歴

5

タグ追加

2021/06/30 08:06

投稿

asano0313
asano0313

スコア2

test CHANGED
File without changes
test CHANGED
File without changes

4

情報追加

2021/06/30 08:06

投稿

asano0313
asano0313

スコア2

test CHANGED
File without changes
test CHANGED
@@ -51,3 +51,151 @@
51
51
 
52
52
 
53
53
  ```
54
+
55
+
56
+
57
+ 情報追加
58
+
59
+ _app.tsx
60
+
61
+ ```typescript
62
+
63
+ import React from "react"
64
+
65
+ import Head from "next/head"
66
+
67
+ import { AppProps } from "next/app"
68
+
69
+ import { ThemeProvider } from "@material-ui/core/styles"
70
+
71
+ import CssBaseline from "@material-ui/core/CssBaseline"
72
+
73
+ import theme from "../components/utils/theme"
74
+
75
+ import '../styles/tailwind.css'
76
+
77
+
78
+
79
+ export default function MyApp({ Component, pageProps }: AppProps) {
80
+
81
+
82
+
83
+ return (
84
+
85
+ <React.Fragment>
86
+
87
+ <Head>
88
+
89
+ <title></title>
90
+
91
+ <meta
92
+
93
+ name="viewport"
94
+
95
+ content="minimum-scale=1, initial-scale=1, width=device-width"
96
+
97
+ />
98
+
99
+ </Head>
100
+
101
+ <ThemeProvider theme={theme}>
102
+
103
+ {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
104
+
105
+ <CssBaseline />
106
+
107
+ <Component {...pageProps} />
108
+
109
+ </ThemeProvider>
110
+
111
+ </React.Fragment>
112
+
113
+ )
114
+
115
+ }
116
+
117
+ ```
118
+
119
+ _documents.tsx
120
+
121
+ ```typescript
122
+
123
+ import React from "react"
124
+
125
+ import Document, { Head, Html, Main, NextScript } from "next/document"
126
+
127
+ import { ServerStyleSheets } from "@material-ui/core/styles"
128
+
129
+ import theme from "../components/utils/theme"
130
+
131
+
132
+
133
+ export default class MyDocument extends Document {
134
+
135
+ render() {
136
+
137
+ return (
138
+
139
+ <Html lang="ja-JP">
140
+
141
+ <Head>
142
+
143
+ {/* PWA primary color */}
144
+
145
+ <meta name="theme-color" content={theme.palette.primary.main} />
146
+
147
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
148
+
149
+ </Head>
150
+
151
+ <body>
152
+
153
+ <Main />
154
+
155
+ <NextScript />
156
+
157
+ </body>
158
+
159
+ </Html>
160
+
161
+ )
162
+
163
+ }
164
+
165
+ }
166
+
167
+
168
+
169
+ MyDocument.getInitialProps = async (ctx) => {
170
+
171
+ const sheets = new ServerStyleSheets()
172
+
173
+ const originalRenderPage = ctx.renderPage
174
+
175
+
176
+
177
+ ctx.renderPage = () =>
178
+
179
+ originalRenderPage({
180
+
181
+ enhanceApp: (App) => (props) => sheets.collect(<App {...props} />)
182
+
183
+ })
184
+
185
+
186
+
187
+ const initialProps = await Document.getInitialProps(ctx)
188
+
189
+
190
+
191
+ return {
192
+
193
+ ...initialProps,
194
+
195
+ styles: [...React.Children.toArray(initialProps.styles), sheets.getStyleElement()]
196
+
197
+ }
198
+
199
+ }
200
+
201
+ ```

3

typo

2021/06/30 07:42

投稿

asano0313
asano0313

スコア2

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

2

tailwind.confug.js

2021/06/30 07:39

投稿

asano0313
asano0313

スコア2

test CHANGED
File without changes
test CHANGED
@@ -13,3 +13,41 @@
13
13
  ![イメージ説明](d1d683f9186e8074a3f0224f2c99bf98.png)
14
14
 
15
15
  分かる方がいたらご教授いただければ幸いです。
16
+
17
+
18
+
19
+
20
+
21
+ tailwind.confug.js
22
+
23
+ ```
24
+
25
+ module.exports = {
26
+
27
+ mode: 'jit',
28
+
29
+ purge: ['./src/**/*.{js,jsx,ts,tsx}'],
30
+
31
+ darkMode: false, // or 'media' or 'class'
32
+
33
+ theme: {
34
+
35
+ extend: {},
36
+
37
+ },
38
+
39
+ variants: {
40
+
41
+ extend: {},
42
+
43
+ },
44
+
45
+ plugins: [],
46
+
47
+ important: true,
48
+
49
+ }
50
+
51
+
52
+
53
+ ```

1

画像追加

2021/06/30 07:31

投稿

asano0313
asano0313

スコア2

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