|
1 | 1 | # W3C CSS Validator |
2 | | -A modern package for validating CSS using [W3C's public CSS validator service](https://jigsaw.w3.org/css-validator/). It simplifies and standardizes the API that W3C exposes to follow newer and more JavaScript-specific conventions. The package is written entirely in TypeScript, is thoroughly tested, has zero dependencies, and uses an asynchronous design. |
| 2 | +A modern package for validating CSS using [W3C’s public CSS validator service](https://jigsaw.w3.org/css-validator/). It’s goal is to simplify and standardize the API that W3C exposes, so that it adheres to newer conventions and is intuitive and easy to use. |
| 3 | + |
| 4 | +- 📦 Written entirely in TypeScript |
| 5 | +- 🔬 Thoroughly tested |
| 6 | +- ⚡️ Zero dependencies |
| 7 | +- 🤝 Promise-based design |
| 8 | +- ✨ Tiny size |
| 9 | +- 🌎 Works in Node.js and browsers |
3 | 10 |
|
4 | 11 | ## Getting started |
5 | 12 |
|
@@ -54,7 +61,7 @@ Option | Default | Possible values |
54 | 61 | Option | Explanation |
55 | 62 | :--- | :--- |
56 | 63 | `medium` | The equivalent of the `@media` rule, applied to all of the CSS |
57 | | -`warningLevel` | `0` means don't return any warnings; `1`, `2`, `3` will return warnings (if any), with higher numbers corresponding to more warnings |
| 64 | +`warningLevel` | `0` means don’t return any warnings; `1`, `2`, `3` will return warnings (if any), with higher numbers corresponding to more warnings |
58 | 65 |
|
59 | 66 | Example: |
60 | 67 |
|
@@ -85,24 +92,24 @@ If you ask it to return warnings via `warningLevel`, it will also include a `war |
85 | 92 | { |
86 | 93 | ... |
87 | 94 | warnings: { |
88 | | - line: number; |
89 | | - level: 1 | 2 | 3; |
90 | | - message: string; |
91 | | - }[]; |
| 95 | + line: number; |
| 96 | + level: 1 | 2 | 3; |
| 97 | + message: string; |
| 98 | + }[]; |
92 | 99 | } |
93 | 100 | ``` |
94 | 101 |
|
95 | 102 | ## Errors vs. warnings |
96 | 103 |
|
97 | | -From W3C's [manual](https://jigsaw.w3.org/css-validator/manual.html): |
| 104 | +From W3C’s [manual](https://jigsaw.w3.org/css-validator/manual.html): |
98 | 105 |
|
99 | 106 | > The validator can give you two types of messages: errors and warnings. Errors are given when the checked CSS does not respect the CSS recommendation. Warnings are different from errors since they do not state a problem regarding the specification. They are here to warn that some points might be dangerous and could lead to a strange behavior on some user agents. |
100 | 107 |
|
101 | 108 | ## Throttling |
102 | 109 |
|
103 | | -You should not call the validator more often than **1 req/sec**. From W3C's [manual](https://jigsaw.w3.org/css-validator/manual.html): |
| 110 | +You should not call the validator more often than **1 req/sec**. From W3C’s [manual](https://jigsaw.w3.org/css-validator/manual.html): |
104 | 111 |
|
105 | | -> If you wish to call the validator programmatically for a batch of documents, please make sure that your script will sleep for at least 1 second between requests. The CSS Validation service is a free, public service for all, your respect is appreciated. thanks. |
| 112 | +> If you wish to call the validator programmatically for a batch of documents, please make sure that your script will sleep for at least 1 second between requests. The CSS Validation service is a free, public service for all, your respect is appreciated. |
106 | 113 |
|
107 | 114 | ## Local development |
108 | 115 |
|
|
0 commit comments