Skip to content

Commit 0edef79

Browse files
committed
Move known issues section to GitHub Wiki
1 parent 0be400d commit 0edef79

File tree

1 file changed

+4
-130
lines changed

1 file changed

+4
-130
lines changed

README.md

Lines changed: 4 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ OPTIONS
138138

139139
### sort
140140

141-
By default, CSS MQPacker pack and order media queries as they are defined. See
142-
also [The "First Win" Algorithm][2]. If you want to sort queries automatically,
143-
pass `sort: true` to this module.
141+
By default, CSS MQPacker pack and order media queries as they are defined. If
142+
you want to sort queries automatically, pass `sort: true` to this module.
144143

145144
```javascript
146145
postcss([
@@ -196,130 +195,7 @@ fs.writeFileSync("to.css", result.css);
196195
fs.writeFileSync("to.css.map", result.map);
197196
```
198197

199-
See also [PostCSS document][3] for more about this `options`.
200-
201-
202-
KNOWN ISSUES
203-
------------
204-
205-
### The "First Win" Algorithm
206-
207-
CSS MQPacker is implemented with the "first win" algorithm. This means:
208-
209-
```css
210-
.foo {
211-
width: 10px;
212-
}
213-
214-
@media (min-width: 640px) {
215-
.foo {
216-
width: 150px;
217-
}
218-
}
219-
220-
.bar {
221-
width: 20px;
222-
}
223-
224-
@media (min-width: 320px) {
225-
.bar {
226-
width: 200px;
227-
}
228-
}
229-
230-
@media (min-width: 640px) {
231-
.bar {
232-
width: 300px;
233-
}
234-
}
235-
```
236-
237-
Becomes:
238-
239-
```css
240-
.foo {
241-
width: 10px;
242-
}
243-
244-
.bar {
245-
width: 20px;
246-
}
247-
248-
@media (min-width: 640px) {
249-
.foo {
250-
width: 150px;
251-
}
252-
.bar {
253-
width: 300px;
254-
}
255-
}
256-
257-
@media (min-width: 320px) {
258-
.bar {
259-
width: 200px;
260-
}
261-
}
262-
```
263-
264-
This breaks cascading order of `.bar`, and `.bar` will be displayed in `200px`
265-
instead of `300px` even if a viewport wider than `640px`.
266-
267-
I suggest defining a query order at first:
268-
269-
```css
270-
@media (min-width: 320px) { /*! Wider than 320px */ }
271-
@media (min-width: 640px) { /*! Wider than 640px */ }
272-
```
273-
274-
Or sort [`min-width` queries automatically][4].
275-
276-
277-
### CSS Applying Order
278-
279-
CSS MQPacker changes order of rulesets. This may breaks CSS applying order.
280-
281-
```css
282-
@media (min-width: 320px) {
283-
.foo {
284-
width: 100px;
285-
}
286-
}
287-
288-
@media (min-width: 640px) {
289-
.bar {
290-
width: 200px;
291-
}
292-
}
293-
294-
@media (min-width: 320px) {
295-
.baz {
296-
width: 300px;
297-
}
298-
}
299-
```
300-
301-
Becomes:
302-
303-
```css
304-
@media (min-width: 320px) {
305-
.foo {
306-
width: 100px;
307-
}
308-
.baz {
309-
width: 300px;
310-
}
311-
}
312-
313-
@media (min-width: 640px) {
314-
.bar {
315-
width: 200px;
316-
}
317-
}
318-
```
319-
320-
Fine. But If a HTML element has `class="bar baz"` and viewport width larger than
321-
`640px`, that element `width` incorrectly set to `200px` instead of `300px`.
322-
This cannot be resolved only with CSS. So, be careful!
198+
See also [PostCSS document][2] for more about this `options`.
323199

324200

325201
LICENSE
@@ -329,6 +205,4 @@ MIT: http://hail2u.mit-license.org/2014
329205

330206

331207
[1]: https://github.com/postcss/postcss
332-
[2]: #the-first-win-algorithm
333-
[3]: https://github.com/postcss/postcss#source-map
334-
[4]: #sort
208+
[2]: https://github.com/postcss/postcss#source-map

0 commit comments

Comments
 (0)