Skip to content

Commit

Permalink
Remove bad single line comments support
Browse files Browse the repository at this point in the history
  • Loading branch information
porsager committed Apr 14, 2020
1 parent 8ca9537 commit 331b650
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 2 additions & 6 deletions lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function bss({

function global() {
const style = b.apply(b, arguments)
parse(removeComments(style.content).trim(), '__raw').forEach(x =>
parse(style.content.trim(), '__raw').forEach(x =>
insert(x.replace(/\.__raw/g, '').trim())
)
}
Expand All @@ -68,7 +68,7 @@ export default function bss({
return this.className

this.className = b.prefix + ++b.count
const x = parse(removeComments(this.content).trim(), this.className)
const x = parse(this.content.trim(), this.className)
x.forEach(insert)
return x.name
}
Expand Down Expand Up @@ -114,10 +114,6 @@ export default function bss({
return x
}

function removeComments(str) {
return str.replace(/\/\/.*?(\n|$)/g, '\n').replace(/\/\*[\s\S]*?\*\//g, '')
}

function insert(rule) {
if (append) {
style && doc.head && doc.head.appendChild(style)
Expand Down
4 changes: 3 additions & 1 deletion tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ t('Multiline property values', () => {
]
})

t('Comments in strings', () => {
/*
t('Inline comments', () => {
b`position: absolute; // This is absolute
transform: translate(-50%, -50%) // This is multi line
rotate(-45deg); // And here it ends`.toString()
Expand All @@ -176,6 +177,7 @@ t('Comments in strings', () => {
cn() + cn() + '{position:absolute;transform:translate(-50%, -50%) rotate(-45deg);}'
]
})
*/

t('@keyframes', () => {
b`
Expand Down

0 comments on commit 331b650

Please sign in to comment.