From c1031b0e62953d08754507710a4210a8b6e273aa Mon Sep 17 00:00:00 2001 From: JounQin Date: Wed, 5 Sep 2018 09:57:39 +0800 Subject: [PATCH 1/2] fix github.com/vuejs/vue-loader/issues/1395 --- lib/stylePlugins/trim.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 = '' } }) }) From 1211a8e49c4045e7ccbe963090114287887191ae Mon Sep 17 00:00:00 2001 From: JounQin Date: Thu, 18 Oct 2018 12:59:36 +0800 Subject: [PATCH 2/2] fix: related test cases --- test/compileStyle.spec.ts | 4 ++-- test/stylePluginScoped.spec.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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 23e7e13..d9e36ff 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,5 +100,5 @@ 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;}`) })