Skip to content

Commit a20f6ba

Browse files
committed
Accept new line characters in all at-rules
1 parent 1854d0c commit a20f6ba

File tree

41 files changed

+568
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+568
-4
lines changed

lib/parse/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ module.exports = function(css, options){
283283

284284
function atkeyframes() {
285285
var pos = position();
286-
var m = match(/^@([-\w]+)?keyframes */);
286+
var m = match(/^@([-\w]+)?keyframes\s*/);
287287

288288
if (!m) return;
289289
var vendor = m[1];
@@ -342,7 +342,7 @@ module.exports = function(css, options){
342342

343343
function athost() {
344344
var pos = position();
345-
var m = match(/^@host */);
345+
var m = match(/^@host\s*/);
346346

347347
if (!m) return;
348348

@@ -389,7 +389,7 @@ module.exports = function(css, options){
389389

390390
function atcustommedia() {
391391
var pos = position();
392-
var m = match(/^@custom-media (--[^\s]+) *([^{;]+);/);
392+
var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
393393
if (!m) return;
394394

395395
return pos({
@@ -506,7 +506,7 @@ module.exports = function(css, options){
506506

507507

508508
function _compileAtrule(name) {
509-
var re = new RegExp('^@' + name + ' *([^;\\n]+);');
509+
var re = new RegExp('^@' + name + '\\s*([^;]+);');
510510
return function() {
511511
var pos = position();
512512
var m = match(re);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"type": "stylesheet",
3+
"stylesheet": {
4+
"rules": [
5+
{
6+
"type": "charset",
7+
"charset": "\"UTF-8\"",
8+
"position": {
9+
"start": {
10+
"line": 1,
11+
"column": 1
12+
},
13+
"end": {
14+
"line": 3,
15+
"column": 6
16+
},
17+
"source": "input.css"
18+
}
19+
}
20+
]
21+
}
22+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@charset "UTF-8";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@charset
2+
"UTF-8"
3+
;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@charset "UTF-8";
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"type": "stylesheet",
3+
"stylesheet": {
4+
"rules": [
5+
{
6+
"type": "custom-media",
7+
"name": "--test",
8+
"media": "(min-width: 200px)",
9+
"position": {
10+
"start": {
11+
"line": 1,
12+
"column": 1
13+
},
14+
"end": {
15+
"line": 4,
16+
"column": 2
17+
},
18+
"source": "input.css"
19+
}
20+
}
21+
]
22+
}
23+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@custom-media --test (min-width: 200px);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@custom-media
2+
--test
3+
(min-width: 200px)
4+
;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@custom-media --test (min-width: 200px);
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"type": "stylesheet",
3+
"stylesheet": {
4+
"rules": [
5+
{
6+
"type": "document",
7+
"document": "url-prefix()",
8+
"vendor": "",
9+
"rules": [
10+
{
11+
"type": "rule",
12+
"selectors": [
13+
".test"
14+
],
15+
"declarations": [
16+
{
17+
"type": "declaration",
18+
"property": "color",
19+
"value": "blue",
20+
"position": {
21+
"start": {
22+
"line": 6,
23+
"column": 13
24+
},
25+
"end": {
26+
"line": 6,
27+
"column": 24
28+
},
29+
"source": "input.css"
30+
}
31+
}
32+
],
33+
"position": {
34+
"start": {
35+
"line": 5,
36+
"column": 9
37+
},
38+
"end": {
39+
"line": 7,
40+
"column": 10
41+
},
42+
"source": "input.css"
43+
}
44+
}
45+
],
46+
"position": {
47+
"start": {
48+
"line": 1,
49+
"column": 1
50+
},
51+
"end": {
52+
"line": 9,
53+
"column": 6
54+
},
55+
"source": "input.css"
56+
}
57+
}
58+
]
59+
}
60+
}

0 commit comments

Comments
 (0)