diff --git a/lib/stylePlugins/trim.ts b/lib/stylePlugins/trim.ts index a7e9a0d..504d6b2 100644 --- a/lib/stylePlugins/trim.ts +++ b/lib/stylePlugins/trim.ts @@ -4,7 +4,7 @@ import * as postcss from 'postcss' export default postcss.plugin('trim', () => (css: Root) => { css.walk(({ type, raws }) => { if (type === 'rule' || type === 'atrule') { - raws.before = raws.after = '\n' + raws.before = raws.after = '' } }) }) diff --git a/test/compileStyle.spec.ts b/test/compileStyle.spec.ts index efc35ca..7e75a2d 100644 --- a/test/compileStyle.spec.ts +++ b/test/compileStyle.spec.ts @@ -177,7 +177,7 @@ test('media query', () => { expect(result.errors).toHaveLength(0) expect(result.code).toContain( - '@media print {\n.foo[v-scope-xxx] {\n color: #000;\n}\n}' + '@media print {.foo[v-scope-xxx] {\n color: #000;}}' ) }) @@ -196,6 +196,6 @@ test('supports query', () => { expect(result.errors).toHaveLength(0) expect(result.code).toContain( - '@supports ( color: #000 ) {\n.foo[v-scope-xxx] {\n color: #000;\n}\n}' + '@supports ( color: #000 ) {.foo[v-scope-xxx] {\n color: #000;}}' ) }) diff --git a/test/stylePluginScoped.spec.ts b/test/stylePluginScoped.spec.ts index 2062dd3..6451f58 100644 --- a/test/stylePluginScoped.spec.ts +++ b/test/stylePluginScoped.spec.ts @@ -75,9 +75,9 @@ h1 { }` }) - expect(style).toContain(`.test[v-scope-xxx] {\n color: yellow;\n}`) - expect(style).toContain(`.test[v-scope-xxx]:after {\n content: \'bye!\';\n}`) - expect(style).toContain(`h1[v-scope-xxx] {\n color: green;\n}`) + expect(style).toContain(`.test[v-scope-xxx] {\n color: yellow;}`) + expect(style).toContain(`.test[v-scope-xxx]:after {\n content: \'bye!\';}`) + expect(style).toContain(`h1[v-scope-xxx] {\n color: green;}`) // scoped keyframes expect(style).toContain( `.anim[v-scope-xxx] {\n animation: color-v-scope-xxx 5s infinite, other 5s;` @@ -100,7 +100,7 @@ h1 { expect(style).toContain(`@keyframes opacity-v-scope-xxx {`) expect(style).toContain(`@-webkit-keyframes opacity-v-scope-xxx {`) // >>> combinator - expect(style).toContain(`.foo p[v-scope-xxx] .bar {\n color: red;\n}`) + expect(style).toContain(`.foo p[v-scope-xxx] .bar {\n color: red;}`) }) test('pseudo element', () => {