Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(css) add experimental webpack CSS support
- Loading branch information
Showing
11 changed files
with
121 additions
and
3 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
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
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
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,51 @@ | ||
import { createNext, FileRef } from 'e2e-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
import webdriver from 'next-webdriver' | ||
|
||
describe('CSS webpack Experiment', () => { | ||
describe('with basic CSS', () => { | ||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: new FileRef(__dirname), | ||
nextConfig: { | ||
experimental: { | ||
webpackCssExperiment: true, | ||
}, | ||
}, | ||
dependencies: { | ||
react: 'latest', | ||
'react-dom': 'latest', | ||
sass: 'latest', | ||
}, | ||
}) | ||
}) | ||
|
||
afterAll(() => next.destroy()) | ||
|
||
it('should work with basic CSS', async () => { | ||
const browser = await webdriver(next.url, `/`) | ||
const element = await browser.elementByCss('p') | ||
const color = await element.getComputedCss('color') | ||
|
||
expect(color).toBe('rgb(0, 128, 0)') | ||
}) | ||
|
||
it('should work with CSS modules', async () => { | ||
const browser = await webdriver(next.url, `/css-modules`) | ||
const element = await browser.elementByCss('p') | ||
const color = await element.getComputedCss('color') | ||
|
||
expect(color).toBe('rgb(255, 0, 0)') | ||
}) | ||
|
||
it('should work with SASS', async () => { | ||
const browser = await webdriver(next.url, `/sass`) | ||
const element = await browser.elementByCss('p') | ||
const color = await element.getComputedCss('color') | ||
|
||
expect(color).toBe('rgb(0, 0, 255)') | ||
}) | ||
}) | ||
}) |
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,4 @@ | ||
import '../styles/global.css' | ||
export default function MyApp({ Component, pageProps }) { | ||
return <Component {...pageProps} /> | ||
} |
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,4 @@ | ||
import * as styles from '../styles/styles.module.css' | ||
export default function Page() { | ||
return <p className={styles.hello}>hello world</p> | ||
} |
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,3 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} |
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,4 @@ | ||
import * as styles from '../styles/styles.module.sass' | ||
export default function Page() { | ||
return <p className={styles.hello}>hello world</p> | ||
} |
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,4 @@ | ||
p { | ||
color: green; | ||
font-size: 2rem; | ||
} |
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,3 @@ | ||
.hello { | ||
color: red; | ||
} |
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,4 @@ | ||
$color: blue | ||
|
||
.hello | ||
color: $color |