Skip to content

Commit f31b85b

Browse files
committed
Doc: update with latests introduced feature (nesting + initial value)
Close MoOx#240
1 parent 583957e commit f31b85b

File tree

6 files changed

+200
-159
lines changed

6 files changed

+200
-159
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ It transforms CSS specs into more compatible CSS so you don’t need to wait for
2424
For questions and support please visit the
2525
[gitter room](https://gitter.im/MoOx/postcss-cssnext).
2626

27+
For offline documentation, check out `statinamic/docs/content`.
28+
2729
---
2830

2931
_The [issue tracker](https://github.com/MoOx/postcss-cssnext/issues) is exclusively for bug reports and feature requests._

docs/content/features.md

Lines changed: 87 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ backgroundModifier: darkRoad
77

88
@[toc]
99

10+
**Note that according to your [browser scope](usage/#browsers) some
11+
transformation can be skipped to avoid extra useless output.**
12+
Eg: if you use don't cover IE 8, rem fallback and rgba fallback might be skipped.
13+
1014
## automatic vendor prefixes
1115

1216
Vendor prefixes are automatically added (and removed if deprecated/useless
1317
depending on your browser scope) using
14-
[autoprefixer](https://github.com/postcss/autoprefixer))
18+
**[autoprefixer](https://github.com/postcss/autoprefixer)**).
1519

1620

1721
## custom properties & `var()`
@@ -120,7 +124,34 @@ Alows you to create your own selectors
120124
|
121125
[Plugin documentation](https://github.com/postcss/postcss-custom-selector)
122126

123-
## `color()`
127+
## nesting
128+
129+
Allow you to nest selectors
130+
131+
```scss
132+
a {
133+
/* direct nesting (& MUST be the first part of selector)*/
134+
& span {
135+
color: white;
136+
}
137+
138+
/* @nest rule (for complex nesting) */
139+
@nest span & {
140+
color: blue;
141+
}
142+
143+
/* media query automatic nesting */
144+
@media (min-width: 30em) {
145+
color: yellow;
146+
}
147+
}
148+
```
149+
150+
[Specification](http://tabatkins.github.io/specs/css-nesting/)
151+
|
152+
[Plugin documentation](https://github.com/jonathantneal/postcss-nesting)
153+
154+
## `color()` function
124155

125156
a color function to modify colors (transpiled to: `rgba()`)
126157

@@ -142,7 +173,7 @@ so be sure to check them !
142173
|
143174
[Plugin documentation](https://github.com/postcss/postcss-color-function)
144175

145-
## `hwb()`
176+
## `hwb()` function
146177

147178
Similar to `hsl()` but easier for humans to work with (transpiled to: `rgba()`).
148179

@@ -156,7 +187,7 @@ body {
156187
|
157188
[Plugin documentation](https://github.com/postcss/postcss-color-hwb)
158189

159-
## `gray()`
190+
## `gray()` function
160191

161192
Allow you to use more than 50 shades of gray (transpiled to: `rgba()`).
162193
For the first argument, you can use a number between 0 and 255 or a percentage.
@@ -175,7 +206,7 @@ For the first argument, you can use a number between 0 and 255 or a percentage.
175206
|
176207
[Plugin documentation](https://github.com/postcss/postcss-color-gray)
177208

178-
## #rrggbbaa
209+
## `#rrggbbaa` colors
179210

180211
Allows use to use 4 or 8 digits hexadecimal notation (transpiled to: `rgba()`).
181212

@@ -189,7 +220,23 @@ body {
189220
|
190221
[Plugin documentation](https://github.com/postcss/postcss-color-hex-alpha)
191222

192-
## `rebeccapurple`
223+
## `rgba` function (`rgb` fallback)
224+
225+
Add solid colors fallback for rgba colors
226+
(if you browser scope cover old browsers, eg: IE8).
227+
228+
```css
229+
body {
230+
background: rgba(153, 221, 153, 0.8);
231+
/* you will have the same value without alpha as a fallback */
232+
}
233+
```
234+
235+
[Specification](http://www.w3.org/TR/css3-color/)
236+
|
237+
[Plugin documentation](https://github.com/postcss/postcss-color-rgba-fallback)
238+
239+
## `rebeccapurple` color
193240

194241
Allows you to use the new color keyword as a homage to
195242
[Eric Meyer’s daughter](https://github.com/postcss/postcss-color-rebeccapurple#why-this-plugin-)
@@ -204,8 +251,7 @@ body {
204251
|
205252
[Plugin documentation](https://github.com/postcss/postcss-color-rebeccapurple)
206253

207-
208-
## font-variant
254+
## `font-variant` property
209255

210256
properties (fallback: `font-feature-settings`)
211257

@@ -228,7 +274,7 @@ at the support of
228274
|
229275
[Plugin documentation](https://github.com/postcss/postcss-font-variant)
230276

231-
## filter
277+
## `filter` property
232278

233279
The W3C filters are only transformed as svg filter using the `url(data:*)` trick
234280
for Firefox < 35.
@@ -243,10 +289,38 @@ for Firefox < 35.
243289
|
244290
[Plugin documentation](https://github.com/iamvdo/pleeease-filters)
245291

246-
## `rem` units
292+
## `initial` value
293+
294+
Allow you to use `initial` value for any value. This value represents the value
295+
specified as the property’s initial value. **It does not mean browser default.**
296+
297+
For example, for the `display` property, `initial` always means `inline`,
298+
because that’s the designated initial value of the property.
299+
As an example, using `div { display: initial }`, will **not** be `block`, but
300+
`inline`.
301+
302+
```css
303+
div {
304+
display: initial; /* inline */
305+
}
306+
```
307+
308+
_Killer feature :_
309+
310+
```css
311+
div {
312+
all: initial; /* use initial for ALL PROPERTIES in one shot */
313+
}
314+
```
315+
316+
[Specification](http://www.w3.org/TR/css3-values/#common-keywords)
317+
|
318+
[Plugin documentation](https://github.com/maximkoretskiy/postcss-initial)
319+
320+
## `rem` unit (`px` fallback)
247321

248322
`rem` fallback to `px`
249-
(if you browser scope cover old browsers).
323+
(if you browser scope cover old browsers, eg: IE8).
250324

251325
```css
252326
h1 {
@@ -303,10 +377,10 @@ p:not(:first-child, .special) {
303377
|
304378
[Plugin documentation](https://github.com/postcss/postcss-selector-NOT)
305379

306-
## pseudo-elements
380+
## `::` pseudo syntax (`:` fallback)
307381

308382
Adjust `::` to `:`
309-
(if you browser scope cover old browsers)
383+
(if you browser scope cover old browsers, eg: IE8).
310384

311385
```css
312386
a::before {
@@ -318,25 +392,6 @@ a::before {
318392
|
319393
[Plugin documentation](https://github.com/axa-ch/postcss-pseudoelements)
320394

321-
## Alpha colors
322-
323-
Add solid colors fallback for rgba colors
324-
(if you browser scope cover old browsers)
325-
326-
```css
327-
body {
328-
background: rgba(153, 221, 153, 0.8);
329-
/* you will have the same value without alpha as a fallback */
330-
}
331-
```
332-
333-
[Specification](http://www.w3.org/TR/css3-color/)
334-
|
335-
[Plugin documentation](https://github.com/postcss/postcss-color-rgba-fallback)
336-
337-
_Note that according to your [browser scope](#nodejs-options) some might be not
338-
transpiled to avoid extra useless output._
339-
340395
## @todo
341396

342397
Any omissions of the CSS specifications (even in draft) that are subject to be

docs/content/index.md

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,69 +48,82 @@ title: cssnext - Use tomorrow’s CSS syntax, today.
4848
<h2 class="cssnext-Section-title"><a href="/features/">Features</a></h2>
4949
<ul class="r-Grid cssnext-List cssnext-FeaturesList">
5050
<li class="r-Grid-cell r-minS--1of2">
51-
custom properties & `var()`
51+
<a href="/features/#automatic-vendor-prefixes">automatic vendor prefixes</a>
5252
</li>
5353
<li class="r-Grid-cell r-minS--1of2">
54-
reduced `calc()`
54+
<a href="/features/#custom-properties-var">custom properties & <code>var()</code></a>
5555
</li>
5656
<li class="r-Grid-cell r-minS--1of2">
57-
custom media queries
57+
<a href="/features/#reduced-calc">reduced <code>calc()</code></a>
5858
</li>
5959
<li class="r-Grid-cell r-minS--1of2">
60-
media queries ranges
60+
<a href="/features/#custom-media-queries">custom media queries</a>
6161
</li>
6262
<li class="r-Grid-cell r-minS--1of2">
63-
custom selectors
63+
<a href="/features/#media-queries-ranges">media queries ranges</a>
6464
</li>
6565
<li class="r-Grid-cell r-minS--1of2">
66-
automatic vendor prefixes
66+
<a href="/features/#custom-selectors">custom selectors</a>
6767
</li>
6868
<li class="r-Grid-cell r-minS--1of2">
69-
`color()` support
69+
<a href="/features/#nesting">nesting</a>
7070
</li>
7171
<li class="r-Grid-cell r-minS--1of2">
72-
`gray()` support
72+
<a href="/features/#color-function"><code>color()</code> function</a>
7373
</li>
7474
<li class="r-Grid-cell r-minS--1of2">
75-
`hwb()` support
75+
<a href="/features/#hwb-function"><code>hwb()</code> function</a>
7676
</li>
7777
<li class="r-Grid-cell r-minS--1of2">
78-
hexa `#rrggbbaa` support
78+
<a href="/features/#gray-function"><code>gray()</code> function</a>
7979
</li>
8080
<li class="r-Grid-cell r-minS--1of2">
81-
`rebeccapurple`
81+
<a href="/features/#rrggbbaa-colors"><code>#rrggbbaa</code> colors</a>
8282
</li>
8383
<li class="r-Grid-cell r-minS--1of2">
84-
`:matches` pseudo-class
84+
<a href="/features/#rgba-function-rgb-fallback"><code>rgba</code> function
85+
<small class="cssnext-FeaturesList-small">
86+
(<code>rgb</code> fallback</code>)
87+
</small>
88+
</a>
8589
</li>
8690
<li class="r-Grid-cell r-minS--1of2">
87-
`:not` pseudo-class
88-
<small class="cssnext-FeaturesList-small">
89-
(to l.3)
90-
</small>
91+
<a href="/features/#rebeccapurple-color"><code>rebeccapurple</code> color</a>
9192
</li>
9293
<li class="r-Grid-cell r-minS--1of2">
93-
font-variant
94+
<a href="/features/#font-variant-property"><code>font-variant</code> property</a>
95+
</li>
96+
<li class="r-Grid-cell r-minS--1of2">
97+
<a href="/features/#filter-property"><code>filter</code> property</a>
9498
<small class="cssnext-FeaturesList-small">
95-
(to font-feature-settings)
99+
(svg fallback)
96100
</small>
97101
</li>
98102
<li class="r-Grid-cell r-minS--1of2">
99-
filters
103+
<a href="/features/#initial-value"><code>initial</code> value</a>
104+
</li>
105+
<li class="r-Grid-cell r-minS--1of2">
106+
<a href="/features/#rem-unit-px-fallback"><code>rem</code> unit</a>
100107
<small class="cssnext-FeaturesList-small">
101-
(svg fallback)
108+
(<code>px</code> fallback)
102109
</small>
103110
</li>
104111
<li class="r-Grid-cell r-minS--1of2">
105-
`rem` units fallback
112+
<a href="/features/#any-link-pseudo-class"><code>:any-link</code> pseudo-class</a>
113+
</li>
114+
<li class="r-Grid-cell r-minS--1of2">
115+
<a href="/features/#matches-pseudo-class"><code>:matches</code> pseudo-class</a>
116+
</li>
117+
<li class="r-Grid-cell r-minS--1of2">
118+
<a href="/features/#not-pseudo-class"><code>:not</code> pseudo-class</a>
106119
<small class="cssnext-FeaturesList-small">
107-
(to px)
120+
(to l.3)
108121
</small>
109122
</li>
110123
<li class="r-Grid-cell r-minS--1of2">
111-
::pseudo syntax
124+
<a href="/features/#pseudo-syntax-fallback"><code>::</code>pseudo syntax</a>
112125
<small class="cssnext-FeaturesList-small">
113-
(`:` compat)
126+
(<code>:</code> fallback)
114127
</small>
115128
</li>
116129
</ul>
@@ -119,7 +132,7 @@ title: cssnext - Use tomorrow’s CSS syntax, today.
119132
style="display: block; text-align: center;"
120133
>
121134
<small>
122-
_l.* are level of the specification (when information is relevant)_
135+
<em>l.* are level of the specification (when information is relevant)</em>
123136
</small>
124137
</small>
125138
</div>

docs/content/usage.md

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -61,43 +61,8 @@ var output = cssnext(input, {
6161
})
6262
```
6363

64-
To know all available options, please check corresponding postcss plugin:
65-
66-
- `customProperties`
67-
[(=> postcss-custom-properties)](https://www.npmjs.com/package/postcss-custom-properties)
68-
- `calc`
69-
[(=> postcss-calc)](https://www.npmjs.com/package/postcss-calc)
70-
- `customMedia`
71-
[(=> postcss-custom-media)](https://www.npmjs.com/package/postcss-custom-media)
72-
- `mediaQueriesRange`
73-
[(=> postcss-media-minmax)](https://www.npmjs.com/package/postcss-media-minmax)
74-
- `customSelectors`
75-
[(=> postcss-custom-selectors)](https://www.npmjs.com/package/postcss-custom-selectors)
76-
- `colorRebeccapurple`
77-
[(=> postcss-color-rebeccapurple)](https://www.npmjs.com/package/postcss-color-rebeccapurple)
78-
- `colorHwb`
79-
[(=> postcss-color-hwb)](https://www.npmjs.com/package/postcss-color-hwb)
80-
- `colorGray`
81-
[(=> postcss-color-gray)](https://www.npmjs.com/package/postcss-color-gray)
82-
- `colorHexAlpha`
83-
[(=> postcss-color-hex-alpha)](https://www.npmjs.com/package/postcss-color-hex-alpha)
84-
- `colorFunction`
85-
[(=> postcss-color-function)](https://www.npmjs.com/package/postcss-color-function)
86-
- `fontVariant`
87-
[(=> postcss-font-variant)](https://www.npmjs.com/package/postcss-font-variant)
88-
- `filter`
89-
[(=> pleeease-filters)](https://www.npmjs.com/package/pleeease-filters)
90-
- `rem`
91-
[(=> pixrem)](https://www.npmjs.com/package/pixrem)
92-
- `pseudoElements`
93-
[(=> postcss-pseudoelements)](https://www.npmjs.com/package/postcss-pseudoelements)
94-
- `pseudoClassMatches`
95-
[(=> postcss-selector-matches)](https://www.npmjs.com/package/postcss-selector-matches)
96-
- `pseudoClassNot`
97-
[(=> postcss-selector-not)](https://www.npmjs.com/package/postcss-selector-not)
98-
- `colorRgba`
99-
[(=> postcss-color-rgba-fallback)](https://www.npmjs.com/package/postcss-color-rgba-fallback)
100-
- `autoprefixer`
101-
[(=> autoprefixer-core)](https://www.npmjs.com/package/autoprefixer-core)
64+
**To know all available options, please check corresponding postcss plugin by
65+
browsing the
66+
[feature mapping](https://github.com/MoOx/postcss-cssnext/blob/master/src/features.js).**
10267

10368
_Note: order is important to get everything working correctly._

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"homepage": "http://cssnext.io/",
1616
"main": "lib/index.js",
1717
"files": [
18+
"docs/content",
1819
"lib",
1920
"src",
2021
"!**/__tests__"

0 commit comments

Comments
 (0)