@@ -162,3 +162,89 @@ describe.each(['turbo', 'webpack'])('%s', (bundler) => {
162162 } ,
163163 )
164164} )
165+
166+ test . only (
167+ 'should scan dynamic route segments' ,
168+ {
169+ fs : {
170+ 'package.json' : json `
171+ {
172+ "dependencies": {
173+ "react": "^18",
174+ "react-dom": "^18",
175+ "next": "^14"
176+ },
177+ "devDependencies": {
178+ "@tailwindcss/postcss": "workspace:^",
179+ "tailwindcss": "workspace:^"
180+ }
181+ }
182+ ` ,
183+ 'postcss.config.mjs' : js `
184+ /** @type {import('postcss-load-config').Config} */
185+ const config = {
186+ plugins: {
187+ '@tailwindcss/postcss': {},
188+ },
189+ }
190+
191+ export default config
192+ ` ,
193+ 'next.config.mjs' : js `
194+ /** @type {import('next').NextConfig} */
195+ const nextConfig = {}
196+
197+ export default nextConfig
198+ ` ,
199+ 'app/a/[slug]/page.js' : js `
200+ export default function Page() {
201+ return <h1 className="content-['[slug]']">Hello, Next.js!</h1>
202+ }
203+ ` ,
204+ 'app/b/[...slug]/page.js' : js `
205+ export default function Page() {
206+ return <h1 className="content-['[...slug]']">Hello, Next.js!</h1>
207+ }
208+ ` ,
209+ 'app/c/[[...slug]]/page.js' : js `
210+ export default function Page() {
211+ return <h1 className="content-['[[...slug]]']">Hello, Next.js!</h1>
212+ }
213+ ` ,
214+ 'app/d/(theme)/page.js' : js `
215+ export default function Page() {
216+ return <h1 className="content-['(theme)']">Hello, Next.js!</h1>
217+ }
218+ ` ,
219+ 'app/layout.js' : js `
220+ import './globals.css'
221+
222+ export default function RootLayout({ children }) {
223+ return (
224+ <html>
225+ <body>{children}</body>
226+ </html>
227+ )
228+ }
229+ ` ,
230+ 'app/globals.css' : css `
231+ @import 'tailwindcss/utilities' source(none);
232+ @source './**/*.{js,ts,jsx,tsx,mdx}';
233+ ` ,
234+ } ,
235+ } ,
236+ async ( { fs, exec, expect } ) => {
237+ await exec ( 'pnpm next build' )
238+
239+ let files = await fs . glob ( '.next/static/css/**/*.css' )
240+ expect ( files ) . toHaveLength ( 1 )
241+ let [ filename ] = files [ 0 ]
242+
243+ await fs . expectFileToContain ( filename , [
244+ candidate `content-['[slug]']` ,
245+ candidate `content-['[...slug]']` ,
246+ candidate `content-['[[...slug]]']` ,
247+ candidate `content-['(theme)']` ,
248+ ] )
249+ } ,
250+ )
0 commit comments