Skip to content

Commit e7d1d04

Browse files
committed
Fix clean code
1 parent ccd8908 commit e7d1d04

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CSSObject/CSSParser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ class CSSParser extends StatmentsParser(BlocksParser(ParserBlock)) {
4747
* @returns string
4848
*/
4949
clean(cssText) {
50-
let css = ICSS.REGEX_REPLACE(cssText, {'\n': '', '\r': '', '\t': ''})
50+
let css = ICSS.REGEX_REPLACE(cssText, {'\n': '', '\r': '', '\t': '', ' ': ''})
5151
this.comments.map(c => css = css.replace(c.toString(), ICSS.EMPTY))
5252

53-
return css
53+
return css.trim()
5454
}
5555
}
5656

CSSObject/parser/CommentBlock.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class CommentBlock {
2323
*/
2424
set block({block, line}) {
2525
this.line = line
26-
this.text = block.replace(/[/*][*/]/g, "")
26+
this.text = block
27+
.split(ICSS.COMMENT.BEGIN).pop()
28+
.split(ICSS.COMMENT.END).shift()
29+
2730
this.comment = this.text.trim()
2831
.replaceAll(ICSS.BREAK_LINE, ICSS.EMPTY)
2932
}

0 commit comments

Comments
 (0)