Skip to content

Commit 0e41cb7

Browse files
author
James Kolce
committed
[ref: #8] Add pr unit to transform px to rem
1 parent 7cfd451 commit 0e41cb7

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

lib/compile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = (file) => {
88

99
return postcss([
1010
require('postcss-lh'),
11+
require('postcss-pr'),
1112
require('postcss-custom-media'),
1213
require('postcss-media-minmax'),
1314
require('autoprefixer')

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
"node-sass": "^3.7.0",
1818
"postcss": "^5.0.21",
1919
"postcss-custom-media": "^5.0.1",
20+
"postcss-lh": "jameskolce/postcss-lh",
2021
"postcss-media-minmax": "^2.1.2",
21-
"postcss-lh": "jameskolce/postcss-lh"
22+
"postcss-pr": "^1.0.0"
2223
},
2324
"devDependencies": {
2425
"tape": "^4.5.1"

test/fixtures/pxToRem/pxToRem.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
:root {
2+
font: 16px / 1.5 "Helvetica", "Arial", sans-serif;
3+
}
4+
5+
@media (max-width: 500px) {
6+
:root {
7+
font-size: 14px;
8+
}
9+
}
10+
11+
@media print {
12+
:root {
13+
font: 11pt / 1.3 "Georgia", "Times New Roman", "Times", serif;
14+
}
15+
}
16+
17+
p {
18+
margin-bottom: 1.5rem;
19+
padding-top: 2rem;
20+
}

test/fixtures/pxToRem/pxToRem.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
:root {
2+
font: 16px / 1.5 "Helvetica", "Arial", sans-serif;
3+
4+
@media (max-width: 500px) {
5+
font-size: 14px;
6+
}
7+
}
8+
9+
@media print {
10+
:root {
11+
font: 11pt / 1.3 "Georgia", "Times New Roman", "Times", serif;
12+
}
13+
}
14+
15+
p {
16+
margin-bottom: 24pr;
17+
padding-top: 32pr;
18+
}

test/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,10 @@ test('units', (t) => {
3030
expected('verticalRhythm'),
3131
'should be added');
3232

33+
t.equal(
34+
actual('pxToRem'),
35+
expected('pxToRem'),
36+
'should be added');
37+
3338
t.end();
3439
});

0 commit comments

Comments
 (0)