diff --git a/lib/img.js b/lib/img.js index 21a673a..271cb7e 100644 --- a/lib/img.js +++ b/lib/img.js @@ -17,8 +17,8 @@ function getImgUrl(ctx, baseClass, opt) { const root = ctx.rootContext || process.cwd(); const subImgPath = baseClass.split(opt.prefix)[1].replace(/_/g, '/'); const imgPath = path.join(opt.imgDir, subImgPath); - const absolutePath = path.join(root, imgPath) - const relativePath = path.relative(file, absolutePath).slice(1); + const absolutePath = path.join(root, imgPath).replace(/\\/g, '/'); + const relativePath = path.relative(file, absolutePath).slice(1).replace(/\\/g, '/'); const type = getImgType(imgPath, opt) return [type, imgPath + type, relativePath + type]; }