Skip to content

Commit 1a69b76

Browse files
author
Alexander Ryzhikov
committed
Adds loader-utils to deps
1 parent 659f126 commit 1a69b76

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

lib/utils.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ var objectify = function objectify(root, filepath) {
6868
if (rule.parent && rule.parent.selectors.find(function (sel) {
6969
return sel === ':root';
7070
})) {
71-
var v = rule.value; // replace "--"
71+
var value = rule.value;
7272

73-
result[rule.prop.replace(/^-+/, '')] = v.endsWith('px') ? parseInt(v, 10) : v;
73+
var key = rule.prop.replace(/^-+/, ''); // replace "--"
74+
75+
result[key] = value.endsWith('px') ? parseInt(value, 10) : value;
7476
}
7577
});
7678
return result;

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
"lib/"
88
],
99
"keywords": [
10-
"css4",
1110
"css2js",
11+
"css4",
12+
"cssnext",
1213
"postcss",
1314
"postcss-plugin",
1415
"webpack",
@@ -39,6 +40,7 @@
3940
"validate"
4041
],
4142
"dependencies": {
43+
"loader-utils": "^0.2.16",
4244
"lodash": "^4.16.4",
4345
"postcss": "^5.2.5",
4446
"postcss-cssnext": "^2.8.0",
@@ -61,7 +63,6 @@
6163
"eslint-config-standard": "^6.2.0",
6264
"eslint-plugin-promise": "^3.3.0",
6365
"eslint-plugin-standard": "^2.0.1",
64-
"loader-utils": "^0.2.16",
6566
"memory-fs": "^0.3.0",
6667
"nsp": "^2.2.0",
6768
"nyc": "^8.3.2",

src/lib/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ const objectify = (root, filepath) => {
4646
return
4747
}
4848
if (rule.parent && rule.parent.selectors.find((sel) => sel === ':root')) {
49-
const v = rule.value // replace "--"
49+
const { value } = rule
50+
const key = rule.prop.replace(/^-+/, '') // replace "--"
5051

51-
result[rule.prop.replace(/^-+/, '')] = v.endsWith('px') ? parseInt(v, 10) : v
52+
result[key] = value.endsWith('px') ? parseInt(value, 10) : value
5253
}
5354
})
5455
return result

0 commit comments

Comments
 (0)