Skip to content

Commit 4487157

Browse files
committed
Merge pull request #99 from makque/fix-93-at-rules
Proposed fix for #93
2 parents a6ed986 + 8e9f363 commit 4487157

4 files changed

Lines changed: 8396 additions & 0 deletions

File tree

src/count.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ function count(ast) {
2020
case 'keyframes':
2121
case 'import':
2222
case 'supports':
23+
case 'charset':
24+
case 'namespace':
2325
return 0;
26+
case 'page':
27+
return 1;
2428
default:
2529
return countRules(ast.rules);
2630
}

test/fixtures/input/at-rules.css

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
@charset "UTF-8"; /* Test @charset, Test @charset as first line */
2+
3+
/* Test @import */
4+
@import 'global.css';
5+
6+
/* Test @namespace */
7+
@namespace url(http://www.w3.org/1999/xhtml); /* Namespace for XHTML */
8+
9+
@namespace svg url(http://www.w3.org/2000/svg); /* Namespace for SVG embedded in XHTML */
10+
11+
/* Test @media */
12+
@media only screen
13+
and (min-device-width: 320px)
14+
and (max-device-width: 480px)
15+
and (-webkit-min-device-pixel-ratio: 2) {
16+
.module {
17+
width: 100%;
18+
}
19+
}
20+
21+
@media print {
22+
23+
}
24+
25+
/* Test @supports */
26+
@supports (display: flex) {
27+
.module {
28+
display: flex;
29+
}
30+
}
31+
32+
@supports (display: flex) and (-webkit-appearance: checkbox) {
33+
.module {
34+
display: flex;
35+
}
36+
}
37+
38+
/* Test @document */
39+
@document /* Rules for a specific page */
40+
url(http://css-tricks.com/),
41+
url-prefix(http://css-tricks.com/snippets/),
42+
domain(css-tricks.com),
43+
regexp("https:.*") {
44+
body {
45+
font-family: Comic Sans;
46+
}
47+
}
48+
49+
/* Test @page */
50+
@page :first {
51+
margin: 1in;
52+
}
53+
54+
/* Test @font-face */
55+
@font-face {
56+
font-family: 'MyWebFont';
57+
src: url('myfont.woff2') format('woff2'),
58+
url('myfont.woff') format('woff');
59+
}
60+
61+
/* Test @keyframes */
62+
@keyframes pulse {
63+
0% {
64+
background-color: #001f3f;
65+
}
66+
67+
100% {
68+
background-color: #ff4136;
69+
}
70+
}
71+
72+
/* Test @viewport */
73+
@viewport {
74+
min-width: 640px;
75+
max-width: 800px;
76+
}
77+
78+
@viewport {
79+
zoom: 0.75;
80+
min-zoom: 0.5;
81+
max-zoom: 0.9;
82+
}
83+
84+
@viewport {
85+
orientation: landscape;
86+
}
87+
88+
/* Test @counter-style */
89+
@counter-style circled-alpha {
90+
system: fixed;
91+
symbols: Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ Ⓘ Ⓙ Ⓚ Ⓛ Ⓜ Ⓝ Ⓞ Ⓟ Ⓠ Ⓡ Ⓢ Ⓣ Ⓤ Ⓥ Ⓦ Ⓧ Ⓨ Ⓩ;
92+
suffix: " ";
93+
}
94+
95+
.items {
96+
list-style: circled-alpha;
97+
}

0 commit comments

Comments
 (0)