File tree 4 files changed +69
-2
lines changed
4 files changed +69
-2
lines changed Original file line number Diff line number Diff line change 5
5
- ` source ` is now the CSS string
6
6
- ` filename ` is now the optional filename
7
7
* changed default ` options.position ` value to ` true `
8
+ * remove comments from properties and values
8
9
9
10
1.7.0 / 2013-12-21
10
11
==================
Original file line number Diff line number Diff line change
1
+ // http://www.w3.org/TR/CSS21/grammar.html
2
+ // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
3
+ var commentre = / \/ \* [ ^ * ] * \* + ( [ ^ / * ] [ ^ * ] * \* + ) * \/ / g
4
+
1
5
module . exports = function ( css , options ) {
2
6
options = options || { } ;
3
7
options . position = options . position === false ? false : true ;
@@ -201,8 +205,8 @@ module.exports = function(css, options){
201
205
202
206
var ret = pos ( {
203
207
type : 'declaration' ,
204
- property : prop ,
205
- value : trim ( val [ 0 ] )
208
+ property : prop . replace ( commentre , '' ) ,
209
+ value : trim ( val [ 0 ] ) . replace ( commentre , '' )
206
210
} ) ;
207
211
208
212
// ;
Original file line number Diff line number Diff line change
1
+ a {
2
+ color /**/ : 12px ;
3
+ padding /*4815162342*/ : 1px /**/ 2px /*13*/ 3px ;
4
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "type" : " stylesheet" ,
3
+ "stylesheet" : {
4
+ "rules" : [
5
+ {
6
+ "type" : " rule" ,
7
+ "selectors" : [
8
+ " a"
9
+ ],
10
+ "declarations" : [
11
+ {
12
+ "type" : " declaration" ,
13
+ "property" : " color" ,
14
+ "value" : " 12px" ,
15
+ "position" : {
16
+ "start" : {
17
+ "line" : 2 ,
18
+ "column" : 5
19
+ },
20
+ "end" : {
21
+ "line" : 2 ,
22
+ "column" : 20
23
+ },
24
+ "filename" : " comment.in.css"
25
+ }
26
+ },
27
+ {
28
+ "type" : " declaration" ,
29
+ "property" : " padding" ,
30
+ "value" : " 1px 2px 3px" ,
31
+ "position" : {
32
+ "start" : {
33
+ "line" : 3 ,
34
+ "column" : 5
35
+ },
36
+ "end" : {
37
+ "line" : 3 ,
38
+ "column" : 51
39
+ },
40
+ "filename" : " comment.in.css"
41
+ }
42
+ }
43
+ ],
44
+ "position" : {
45
+ "start" : {
46
+ "line" : 1 ,
47
+ "column" : 1
48
+ },
49
+ "end" : {
50
+ "line" : 4 ,
51
+ "column" : 2
52
+ },
53
+ "filename" : " comment.in.css"
54
+ }
55
+ }
56
+ ]
57
+ }
58
+ }
You can’t perform that action at this time.
0 commit comments