mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-03 19:07:15 +00:00
feat: allow lang="postcss"
in Vue SFCs (#4417)
* fix: allow postcss lang as tag * refactor: own postcss rule
This commit is contained in:
parent
8baf574254
commit
71136fc9b6
@ -198,6 +198,10 @@ export default class WebpackBaseConfig {
|
|||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
oneOf: styleLoader.apply('css')
|
oneOf: styleLoader.apply('css')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
test: /\.postcss$/,
|
||||||
|
oneOf: styleLoader.apply('postcss')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.less$/,
|
test: /\.less$/,
|
||||||
oneOf: styleLoader.apply('less', {
|
oneOf: styleLoader.apply('less', {
|
||||||
|
15
test/fixtures/basic/pages/postcss.vue
vendored
Normal file
15
test/fixtures/basic/pages/postcss.vue
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<div class="red">
|
||||||
|
This is red
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="postcss">
|
||||||
|
@custom-selector :--red div.red;
|
||||||
|
:--red {
|
||||||
|
background-color: blue;
|
||||||
|
}
|
||||||
|
.red {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
@ -40,6 +40,19 @@ describe('basic ssr', () => {
|
|||||||
// t.is(window.getComputedStyle(element).color, 'red')
|
// t.is(window.getComputedStyle(element).color, 'red')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('/postcss', async () => {
|
||||||
|
const window = await nuxt.server.renderAndGetWindow(url('/css'))
|
||||||
|
|
||||||
|
const headHtml = window.document.head.innerHTML
|
||||||
|
expect(headHtml).toContain('color:red')
|
||||||
|
|
||||||
|
const element = window.document.querySelector('.red')
|
||||||
|
expect(element).not.toBe(null)
|
||||||
|
expect(element.textContent).toContain('This is red')
|
||||||
|
expect(element.className).toBe('red')
|
||||||
|
// t.is(window.getComputedStyle(element).color, 'red')
|
||||||
|
})
|
||||||
|
|
||||||
test('/postcss', async () => {
|
test('/postcss', async () => {
|
||||||
const window = await nuxt.server.renderAndGetWindow(url('/css'))
|
const window = await nuxt.server.renderAndGetWindow(url('/css'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user