forked from vercel/next.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow to provide postcss plugin options as a string (vercel#35173)
fixes vercel#35117 @balazsorban44 this needs a test case ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
- Loading branch information
1 parent
6e4ac3c
commit 58f8084
Showing
2 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
test/production/postcss-plugin-config-as-string/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { createNext } from 'e2e-utils' | ||
import { renderViaHTTP } from 'next-test-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
|
||
describe('PostCSS plugin config as string', () => { | ||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: { | ||
'pages/index.js': ` | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} | ||
`, | ||
'global.css': ` | ||
@import "tailwindcss/base"; | ||
@import "tailwindcss/components"; | ||
@import "tailwindcss/utilities"; | ||
`, | ||
'pages/_app.js': ` | ||
import "../global.css" | ||
export default function MyApp({ Component, pageProps }) { | ||
return <Component {...pageProps} /> | ||
} | ||
`, | ||
'postcss.config.js': ` | ||
module.exports = { | ||
plugins: { | ||
'tailwindcss/nesting': 'postcss-nesting', | ||
tailwindcss: {}, | ||
}, | ||
} | ||
`, | ||
'tailwind.config.js': ` | ||
module.exports = { | ||
content: ['./pages/**/*'], | ||
} | ||
`, | ||
}, | ||
dependencies: { | ||
'postcss-nesting': '10.1.3', | ||
tailwindcss: '3.0.23', | ||
}, | ||
}) | ||
}) | ||
afterAll(() => next.destroy()) | ||
|
||
it('should work', async () => { | ||
const html = await renderViaHTTP(next.url, '/') | ||
expect(html).toContain('hello world') | ||
}) | ||
}) |