Skip to content

Commit

Permalink
[create-next-app]: add mdx files to tailwind content config (#48188)
Browse files Browse the repository at this point in the history
This PR updates create-next-app's tailwind config to consider .mdx files
when it generates styles.

If you're using MDX, most of a project's styles are generated by the
other file flags, which can make it tricky to debug/notice the rare
subset from .mdx only.

x-ref: https://vercel.slack.com/archives/C0290CZ3U6Q/p1680976472444189

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
delbaoliveira and ijjk committed Apr 13, 2023
1 parent 37f709e commit ab21349
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-next-app/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ export const installTemplate = async ({
(
await fs.promises.readFile(tailwindConfigFile, 'utf8')
).replace(
/\.\/(\w+)\/\*\*\/\*\.\{js,ts,jsx,tsx\}/g,
'./src/$1/**/*.{js,ts,jsx,tsx}'
/\.\/(\w+)\/\*\*\/\*\.\{js,ts,jsx,tsx,mdx\}/g,
'./src/$1/**/*.{js,ts,jsx,tsx,mdx}'
)
)
}
Expand Down

0 comments on commit ab21349

Please sign in to comment.