Skip to content

Commit

Permalink
2.6.0-beta.7 - block comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
houd1ni committed Apr 27, 2019
1 parent d8a3028 commit 83bfa78
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/bundle.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"prod:es": "cross-env NODE_ENV=production BUILD=es rollup -c",
"prod": "npm run gentypes && npm run prod:es && npm run prod:cjs"
},
"version": "2.6.0beta.6",
"version": "2.6.0beta.7",
"ava": {
"files": [
"./test/specs/*.ts"
Expand Down
5 changes: 3 additions & 2 deletions src/css-lit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ export const css = (() => {
const delimiters = ['\n', '\r', ';']
const isDelimiter = (s: string) => delimiters.includes(s)
const delimRE = new RegExp(`[${delimiters.join('')}]`, 'g')
const commentRE = /^\/\/.*$/
const commentRE = /((^\s*?\/\/.*$)|\/\*(.|[\n\r])*?\*\/)/gm
return (strings: string[], ...values: any[]) => {
const names: string[] = [] // selector names, class names.
const levels = new Levels()
join(strings, values)
.replace(commentRE, '')
.replace(/(\{|\})/g, (_, brace, offset, full) => {
if(!isDelimiter(full[offset-1])) {
brace = ';' + brace
Expand All @@ -98,7 +99,7 @@ export const css = (() => {
})
.split(delimRE)
.forEach((line) => {
line = line.trim().replace(commentRE, '')
line = line.trim()
if(line) {
analyseLine(levels, line, names)
}
Expand Down
4 changes: 3 additions & 1 deletion test/specs/lit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ test('lit-css', (t) => {
margin: some-shit;
padding some-shit; those: shiii
margin-left: ${value}
margin-right: 10px
margin-right: 10px /*
some block comment
*/
>*:first-of-type {
shit 66
.inner {
Expand Down

0 comments on commit 83bfa78

Please sign in to comment.