Skip to content

Remove comments from properties and values in parse time. #49

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 1 commit 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
Remove comments from properties and values in parse time.
  • Loading branch information
vladkens committed Aug 23, 2013
commit 7bdc9e6db5665a698bc5e6f1c32542c2fe965e32
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ module.exports = function(css, options){

var ret = pos({
type: 'declaration',
property: prop,
value: val[0].trim()
property: prop.replace(/\/\*.*\*\//g, ''),
value: val[0].trim().replace(/\/\*.*\*\//g, '')
});

// ;
Expand Down
4 changes: 4 additions & 0 deletions test/cases/comment.in.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a {
color/**/: 12px;
padding/*4815162342*/: 1px /**/ 2px /*13*/ 3px;
}
53 changes: 53 additions & 0 deletions test/cases/comment.in.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"type": "stylesheet",
"stylesheet": {
"rules": [
{
"type": "rule",
"selectors": ["a"],
"declarations": [
{
"type": "declaration",
"property": "color",
"value": "12px",
"position": {
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 2,
"column": 20
}
}
},
{
"type": "declaration",
"property": "padding",
"value": "1px 3px",
"position": {
"start": {
"line": 3,
"column": 5
},
"end": {
"line": 3,
"column": 51
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 4,
"column": 2
}
}
}
]
}
}