Skip to content

Commit 6e17643

Browse files
author
一丝
committed
Uniform variable name
1 parent bd60b33 commit 6e17643

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ function imageSetMixin(decl, i) {
353353
obj.path = "url(" + obj.url + ")";
354354
obj.whichImg = paths[j][3];
355355
if (obj.whichImg == "1x" || obj.whichImg == "1x") {
356-
var normalSizes = sizeOf(_getResourceAbsolutePath(obj.url));
356+
var normalSizes = sizeOf(getAbsolutePath(obj.url));
357357
normalWidth = normalSizes.width + 'px';
358358
normalHeight = normalSizes.height + 'px';
359359

@@ -362,7 +362,7 @@ function imageSetMixin(decl, i) {
362362
value: obj.path
363363
});
364364
} else if (obj.whichImg == "2x" || obj.whichImg == "2x") {
365-
var rSizes = sizeOf(_getResourceAbsolutePath(obj.url)); //2倍图尺寸
365+
var rSizes = sizeOf(getAbsolutePath(obj.url)); //2倍图尺寸
366366
rWidth = rSizes.width / 2 + 'px';
367367
rHeight = rSizes.height / 2 + 'px';
368368
bgSize = rWidth + ' ' + rHeight; //2倍图的宽和高
@@ -405,7 +405,7 @@ function imageSetMixin(decl, i) {
405405
} else if (decl.value.indexOf('url(') != -1) {
406406
//没有image-set,执行以下
407407
var retinaPaths = returnURL(decl.value, reNO_SETURL) //获取第一个url图片的路径
408-
var retinaSizes = sizeOf(_getResourceAbsolutePath(retinaPaths[0][2]));
408+
var retinaSizes = sizeOf(getAbsolutePath(retinaPaths[0][2]));
409409
normalWidth = retinaSizes.width + 'px';
410410
normalHeight = retinaSizes.height + 'px';
411411
}
@@ -482,23 +482,23 @@ function returnURL(val, reg) {
482482
}
483483

484484
//当前处理文件的路径,可以通过处理函数的opts.from得到
485-
var _currentProcessFilePath = '';
485+
var currentFilePath = '';
486486
//获取css文件中的资源的绝对地址
487-
function _getResourceAbsolutePath(sourcePath) {
488-
return path.resolve(_currentProcessFilePath, sourcePath);
487+
function getAbsolutePath(sourcePath) {
488+
return path.resolve(currentFilePath, sourcePath);
489489
}
490490

491491
// PostCSS Processor
492492
var cssprocess = function(css, opts) {
493493
//保存当前处理文件路径
494-
_currentProcessFilePath = path.dirname(opts.from);
494+
currentFilePath = path.dirname(opts.from);
495495
css.eachRule(cssgraceRule);
496496
}
497497

498498
var pack = function(css, opts) {
499499
//保存当前处理文件路径
500-
_currentProcessFilePath = path.dirname(opts.from);
501-
console.log(_currentProcessFilePath);
500+
currentFilePath = path.dirname(opts.from);
501+
console.log(currentFilePath);
502502
return postcss(cssprocess).process(css, opts).css;
503503
}
504504

0 commit comments

Comments
 (0)