Skip to content

fix(trim): don't insert line break #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/stylePlugins/trim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
}
})
})
4 changes: 2 additions & 2 deletions test/compileStyle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;}}'
)
})

Expand All @@ -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;}}'
)
})
8 changes: 4 additions & 4 deletions test/stylePluginScoped.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;`
Expand All @@ -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', () => {
Expand Down