autoprefixer 8.6.1 → 8.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
+ ## 8.6.5
5
+ * Do not show Grid warnings if IE was not selected.
6
+
7
+ ## 8.6.4
8
+ * Fix `stretch` prefix in Chrome >= 46.
9
+
10
+ ## 8.6.3
11
+ * Add warnings for unsupported Grid features.
12
+ * Add warnings about wrong Grid properties.
13
+ * Add note about `grid` option for grid properties in `autoprefixer --info`.
14
+
15
+ ## 8.6.2
16
+ * Fix error during adding Grid prefixes in `@media` (by Evgeny Petukhov).
17
+
4
18
  ## 8.6.1
5
19
  * Fix `grid-template` with media queries (by Evgeny Petukhov).
6
20
 
package/README.md CHANGED
@@ -50,53 +50,11 @@ Twitter account for news and releases: [@autoprefixer].
50
50
  [cult]: http://cultofmartians.com/tasks/autoprefixer-grid.html
51
51
 
52
52
 
53
- ## Features
54
-
55
- ### Write Pure CSS
56
-
57
- Working with Autoprefixer is simple: just forget about vendor prefixes
58
- and write normal CSS according to the latest W3C specs. You don’t need
59
- a special language (like Sass) or remember where you must use mixins.
60
-
61
- Autoprefixer supports selectors (like `:fullscreen` and `::selection`),
62
- unit function (`calc()`), at‑rules (`@supports` and `@keyframes`)
63
- and properties.
64
-
65
- Because Autoprefixer is a postprocessor for CSS,
66
- you can also use it with preprocessors such as Sass, Stylus or LESS.
67
-
68
-
69
- ### Only Actual Prefixes
70
-
71
- Autoprefixer utilizes the most recent data from [Can I Use]
72
- to add only necessary vendor prefixes.
73
-
74
- It also removes old, unnecessary prefixes from your CSS
75
- (like `border-radius` prefixes, produced by many CSS libraries).
76
-
77
- ```css
78
- a {
79
- -webkit-border-radius: 5px;
80
- border-radius: 5px;
81
- }
82
- ```
83
-
84
- compiles to:
85
-
86
- ```css
87
- a {
88
- border-radius: 5px;
89
- }
90
- ```
91
-
92
- [Can I Use]: http://caniuse.com/
93
-
94
-
95
53
  ## Browsers
96
54
 
97
55
  Autoprefixer uses [Browserslist], so you can specify the browsers
98
56
  you want to target in your project by queries like `> 5%`
99
- (see [Best Practises]).
57
+ (see [Best Practices]).
100
58
 
101
59
  The best way to provide browsers is `.browserslistrc` config
102
60
  or `package.json` with `browserslist` key. Put it in your project root.
@@ -110,39 +68,64 @@ and default value.
110
68
 
111
69
  [Browserslist docs]: https://github.com/ai/browserslist#queries
112
70
  [babel-preset-env]: https://github.com/babel/babel-preset-env
113
- [Best Practises]: https://github.com/browserslist/browserslist#best-practices
71
+ [Best Practices]: https://github.com/browserslist/browserslist#best-practices
114
72
  [Browserslist]: https://github.com/ai/browserslist
115
73
  [Stylelint]: http://stylelint.io/
116
74
 
117
75
 
118
- ## Outdated Prefixes
76
+ ## FAQ
119
77
 
120
- By default, Autoprefixer also removes outdated prefixes.
78
+ #### Does Autoprefixer polyfill Grid Layout for IE?
121
79
 
122
- You can disable this behavior with the `remove: false` option. If you have
123
- no legacy code, this option will make Autoprefixer about 10% faster.
80
+ Autoprefixer can be used to use Grid Layout for IE 10 and IE 11.
81
+ But this polyfill will not work in 100 % cases.
82
+ This is why it is disabled by default.
124
83
 
125
- Also, you can set the `add: false` option. Autoprefixer will only clean outdated
126
- prefixes, but will not add any new prefixes.
84
+ First, you need to enable Grid prefixes by `grid: true` option.
127
85
 
128
- Autoprefixer adds new prefixes between any unprefixed properties and already
129
- written prefixes in your CSS. If it will break the expected prefixes order,
130
- you can clean all prefixes from your CSS and then
131
- add the necessary prefixes again:
86
+ Second, you need to test every fix with Grid in IE. It is not,
87
+ enable and forget featur. But it is still very useful.
88
+ Financial Times and Yandex use it in production.
132
89
 
133
- ```js
134
- var cleaner = postcss([ autoprefixer({ add: false, browsers: [] }) ]);
135
- var prefixer = postcss([ autoprefixer ]);
90
+ Third, there is not auto placement and all grid cell position must be set
91
+ explicitly. However, Autoprefixer can covert even `grid-template`
92
+ and `grid-gap` (but only when they are together).
136
93
 
137
- cleaner.process(css).then(function (cleaned) {
138
- return prefixer.process(cleaned.css);
139
- }).then(function (result) {
140
- console.log(result.css);
141
- });
94
+ ```css
95
+ .page {
96
+ display: grid;
97
+ grid-gap: 33px;
98
+ grid-template:
99
+ "head head head" 1fr
100
+ "nav main main" minmax(100px, 1fr)
101
+ "nav foot foot" 2fr /
102
+ 1fr 100px 1fr;
103
+ }
104
+ .page__head {
105
+ grid-area: head;
106
+ }
107
+ .page__nav {
108
+ grid-area: nav;
109
+ }
110
+ .page__main {
111
+ grid-area: main;
112
+ }
113
+ .page__footer {
114
+ grid-area: foot;
115
+ }
142
116
  ```
143
117
 
118
+ See also:
144
119
 
145
- ## FAQ
120
+ * [The guide about Grids in IE and Autoprefixer].
121
+ * [`postcss-gap-properties`] to use new `gap` property
122
+ instead of old `grid-gap`.
123
+ * [`postcss-grid-kiss`] has alternate “everything in one property” syntax,
124
+ which make using Autoprefixer’s Grid safer.
125
+
126
+ [The guide about Grids in IE and Autoprefixer]: https://css-tricks.com/css-grid-in-ie-css-grid-and-the-new-autoprefixer/
127
+ [`postcss-gap-properties`]: https://github.com/jonathantneal/postcss-gap-properties
128
+ [`postcss-grid-kiss`]: https://github.com/sylvainpolletvillard/postcss-grid-kiss
146
129
 
147
130
  #### No prefixes in production
148
131
 
@@ -549,13 +532,6 @@ You can also use comments recursively:
549
532
  }
550
533
  ```
551
534
 
552
- In Sass/SCSS/Less you can use all the disable options above, add an exclamation mark
553
- in the start of comment:
554
-
555
- ```scss
556
- /*! autoprefixer: off */
557
- ```
558
-
559
535
 
560
536
  ## Options
561
537
 
package/data/prefixes.js CHANGED
@@ -392,8 +392,18 @@ f(require('caniuse-lite/data/features/css3-tabsize'), function (browsers) {
392
392
  });
393
393
 
394
394
  // Intrinsic & extrinsic sizing
395
- f(require('caniuse-lite/data/features/intrinsic-width'), function (browsers) {
396
- return prefix(['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch'], {
395
+ var intrinsic = require('caniuse-lite/data/features/intrinsic-width');
396
+
397
+ f(intrinsic, function (browsers) {
398
+ return prefix(['max-content', 'min-content', 'fit-content'], {
399
+ props: ['width', 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size', 'grid', 'grid-template', 'grid-template-rows', 'grid-template-columns', 'grid-auto-columns', 'grid-auto-rows'],
400
+ feature: 'intrinsic-width',
401
+ browsers: browsers
402
+ });
403
+ });
404
+
405
+ f(intrinsic, { match: /x|\s#4/ }, function (browsers) {
406
+ return prefix(['fill', 'fill-available', 'stretch'], {
397
407
  props: ['width', 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size', 'grid', 'grid-template', 'grid-template-rows', 'grid-template-columns', 'grid-auto-columns', 'grid-auto-rows'],
398
408
  feature: 'intrinsic-width',
399
409
  browsers: browsers
@@ -345,7 +345,7 @@ function insertAreas(areas, decl, result) {
345
345
  if (areasCount === areasLength) {
346
346
  var next = gridArea.parent.next();
347
347
 
348
- if (next.type === 'atrule' && next.name === 'media' && next.params === parentMedia.params && next.first.type === 'rule' && next.first.selector && parentMedia.first.selector && /^-ms-/.test(next.first.first.prop)) return undefined;
348
+ if (next && next.type === 'atrule' && next.name === 'media' && next.params === parentMedia.params && next.first.type === 'rule' && next.first.selector && parentMedia.first.selector && /^-ms-/.test(next.first.first.prop)) return undefined;
349
349
 
350
350
  var areaMedia = parentMedia.clone().removeAll().append(rules);
351
351
  gridArea.parent.after(areaMedia);
package/lib/info.js CHANGED
@@ -17,14 +17,16 @@ var names = {
17
17
  and_uc: 'UC for Android'
18
18
  };
19
19
 
20
- var prefix = function prefix(name, prefixes) {
21
- var out = ' ' + name + ': ';
20
+ function prefix(name, prefixes, note) {
21
+ var out = ' ' + name;
22
+ if (note) out += ' *';
23
+ out += ': ';
22
24
  out += prefixes.map(function (i) {
23
25
  return i.replace(/^-(.*)-$/g, '$1');
24
26
  }).join(', ');
25
27
  out += '\n';
26
28
  return out;
27
- };
29
+ }
28
30
 
29
31
  module.exports = function (prefixes) {
30
32
  if (prefixes.browsers.selected.length === 0) {
@@ -107,10 +109,13 @@ module.exports = function (prefixes) {
107
109
 
108
110
  var values = '';
109
111
  var props = '';
112
+ var hadGrid = false;
110
113
  for (var _name in prefixes.add) {
111
114
  var _data = prefixes.add[_name];
112
115
  if (_name[0] !== '@' && _data.prefixes) {
113
- props += prefix(_name, _data.prefixes);
116
+ var grid = _name.indexOf('grid-') === 0;
117
+ if (grid) hadGrid = true;
118
+ props += prefix(_name, _data.prefixes, grid);
114
119
  }
115
120
 
116
121
  if (!_data.values) {
@@ -130,7 +135,9 @@ module.exports = function (prefixes) {
130
135
 
131
136
  var value = _ref3;
132
137
 
133
- var string = prefix(value.name, value.prefixes);
138
+ var _grid = value.name.indexOf('grid') !== -1;
139
+ if (_grid) hadGrid = true;
140
+ var string = prefix(value.name, value.prefixes, _grid);
134
141
  if (values.indexOf(string) === -1) {
135
142
  values += string;
136
143
  }
@@ -143,6 +150,9 @@ module.exports = function (prefixes) {
143
150
  if (values !== '') {
144
151
  out += '\nValues:\n' + values;
145
152
  }
153
+ if (hadGrid) {
154
+ out += '\n* - Prefixes will be added only on grid: true option.\n';
155
+ }
146
156
 
147
157
  if (atrules === '' && selectors === '' && props === '' && values === '') {
148
158
  out += '\nAwesome! Your browsers don\'t require any vendor prefixes.' + '\nNow you can remove Autoprefixer from build steps.';
package/lib/processor.js CHANGED
@@ -66,33 +66,61 @@ var Processor = function () {
66
66
  css.walkDecls(function (decl) {
67
67
  if (_this.disabledDecl(decl, result)) return undefined;
68
68
 
69
- if (decl.prop === 'display' && decl.value === 'box') {
69
+ var prop = decl.prop;
70
+ var value = decl.value;
71
+
72
+ if (prop === 'grid-row-span') {
73
+ result.warn('grid-row-span is not part of final Grid Layout. ' + 'Use grid-row.', { node: decl });
74
+ return undefined;
75
+ } else if (prop === 'grid-column-span') {
76
+ result.warn('grid-column-span is not part of final Grid Layout. ' + 'Use grid-column.', { node: decl });
77
+ return undefined;
78
+ } else if (prop === 'display' && value === 'box') {
70
79
  result.warn('You should write display: flex by final spec ' + 'instead of display: box', { node: decl });
71
80
  return undefined;
72
- }
73
- if (decl.value.indexOf('linear-gradient') !== -1) {
74
- if (OLD_LINEAR.test(decl.value)) {
75
- result.warn('Gradient has outdated direction syntax. ' + 'New syntax is like `to left` instead of `right`.', { node: decl });
81
+ } else if (prop === 'text-emphasis-position') {
82
+ if (value === 'under' || value === 'over') {
83
+ result.warn('You should use 2 values for text-emphasis-position ' + 'For example, `under left` instead of just `under`.', { node: decl });
76
84
  }
77
- }
78
- if (decl.value.indexOf('radial-gradient') !== -1) {
79
- if (OLD_RADIAL.test(decl.value)) {
80
- result.warn('Gradient has outdated direction syntax. ' + 'New syntax is like `closest-side at 0 0` ' + 'instead of `0 0, closest-side`.', { node: decl });
81
- } else {
82
- var match = decl.value.match(RADIAL_BLOCK);
83
-
84
- if (match) {
85
- if (/cover/.test(match[1])) {
86
- result.warn('Gradient has outdated direction syntax. ' + 'Replace `cover` to `farthest-corner`.', { node: decl });
87
- } else if (/contain/.test(match[1])) {
88
- result.warn('Gradient has outdated direction syntax. ' + 'Replace `contain` to `closest-side`.', { node: decl });
85
+ } else {
86
+ var grid = _this.prefixes.add['grid-area'];
87
+ if (_this.prefixes.options.grid && grid && grid.prefixes) {
88
+ if (prop === 'grid-auto-columns') {
89
+ result.warn('grid-auto-columns is not supported by IE', { node: decl });
90
+ return undefined;
91
+ } else if (prop === 'grid-auto-rows') {
92
+ result.warn('grid-auto-rows is not supported by IE', { node: decl });
93
+ return undefined;
94
+ } else if (prop === 'grid-auto-flow') {
95
+ result.warn('grid-auto-flow is not supported by IE', { node: decl });
96
+ return undefined;
97
+ } else if (value.indexOf('auto-fit') !== -1) {
98
+ result.warn('auto-fit value is not supported by IE', { node: decl, word: 'auto-fit' });
99
+ return undefined;
100
+ } else if (value.indexOf('auto-fill') !== -1) {
101
+ result.warn('auto-fill value is not supported by IE', { node: decl, word: 'auto-fill' });
102
+ return undefined;
103
+ }
104
+ }
105
+ if (value.indexOf('radial-gradient') !== -1) {
106
+ if (OLD_RADIAL.test(decl.value)) {
107
+ result.warn('Gradient has outdated direction syntax. ' + 'New syntax is like `closest-side at 0 0` ' + 'instead of `0 0, closest-side`.', { node: decl });
108
+ } else {
109
+ var match = value.match(RADIAL_BLOCK);
110
+
111
+ if (match) {
112
+ if (/cover/.test(match[1])) {
113
+ result.warn('Gradient has outdated direction syntax. ' + 'Replace `cover` to `farthest-corner`.', { node: decl });
114
+ } else if (/contain/.test(match[1])) {
115
+ result.warn('Gradient has outdated direction syntax. ' + 'Replace `contain` to `closest-side`.', { node: decl });
116
+ }
89
117
  }
90
118
  }
91
119
  }
92
- }
93
- if (decl.prop === 'text-emphasis-position') {
94
- if (decl.value === 'under' || decl.value === 'over') {
95
- result.warn('You should use 2 values for text-emphasis-position ' + 'For example, `under left` instead of just `under`.', { node: decl });
120
+ if (value.indexOf('linear-gradient') !== -1) {
121
+ if (OLD_LINEAR.test(value)) {
122
+ result.warn('Gradient has outdated direction syntax. ' + 'New syntax is like `to left` instead of `right`.', { node: decl });
123
+ }
96
124
  }
97
125
  }
98
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "8.6.1",
3
+ "version": "8.6.5",
4
4
  "description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
5
5
  "keywords": ["autoprefixer", "css", "prefix", "postcss", "postcss-plugin"],
6
6
  "author": "Andrey Sitnik <andrey@sitnik.ru>",
@@ -8,10 +8,10 @@
8
8
  "repository": "postcss/autoprefixer",
9
9
  "dependencies": {
10
10
  "browserslist": "^3.2.8",
11
- "caniuse-lite": "^1.0.30000850",
11
+ "caniuse-lite": "^1.0.30000864",
12
12
  "normalize-range": "^0.1.2",
13
13
  "num2fraction": "^1.2.2",
14
- "postcss": "^6.0.22",
14
+ "postcss": "^6.0.23",
15
15
  "postcss-value-parser": "^3.2.3"
16
16
  },
17
17
  "bin": {