Skip to content

Commit

Permalink
Merge pull request #189 from ben-eb/patch-positions
Browse files Browse the repository at this point in the history
Add perspective-origin to the reduce-positions transform.
  • Loading branch information
ben-eb committed May 17, 2016
2 parents 2479ba0 + 0342595 commit b3c09bf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Added: Reduce animation/transition timing functions. Detects `cubic-bezier`
functions that are equivalent to the timing keywords and compresses, as well
as normalizing the `steps` timing function.
* Added the `perspective-origin` property to the list of supported properties
transformed by the `reduce-positions` transform.

* * *

Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@
"source": "https://github.com/ben-eb/postcss-zindex"
}, {
"name": "reduce-positions",
"shortDescription": "Normalizes background-position definitions",
"longDescription": "Normalizes background position in the `background` shorthand and `background-position` properties.",
"shortDescription": "Normalizes CSS position definitions",
"longDescription": "Normalizes `position` values in the `background`, `background-position`, `-webkit-perspective-origin` and `perspective-origin` properties.",
"inputExample": ".box {\n background: 30% center / 50% 50%;\n}",
"outputExample": ".box {\n background: 30% / 50% 50%;\n}",
"source": "https://github.com/ben-eb/cssnano/blob/master/src/lib/reducePositions.js"
Expand Down
8 changes: 8 additions & 0 deletions src/__tests__/modules/cssnano-reduce-positions.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ const decls = [{
property: 'background:',
additional: '#000 url(cat.jpg) ',
tail: ''
}, {
property: 'perspective-origin:',
additional: '',
tail: ''
}, {
property: '-webkit-perspective-origin:',
additional: '',
tail: ''
}];

decls.forEach(({additional, property, tail}) => {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/reducePositions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import valueParser, {unit} from 'postcss-value-parser';
const directions = ['top', 'right', 'bottom', 'left', 'center'];
const properties = [
'background',
'background-position'
'background-position',
'-webkit-perspective-origin',
'perspective-origin',
];

const center = '50%';
Expand Down

0 comments on commit b3c09bf

Please sign in to comment.