From 602e6936115b2bd14caf8495b32147a055b34369 Mon Sep 17 00:00:00 2001 From: army8735 Date: Tue, 3 Sep 2019 16:11:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=86css=E5=BC=95=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=BD=AC=E6=8D=A2=E6=88=90=E7=9B=B8=E5=AF=B9?= =?UTF-8?q?=E6=A0=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/remax-cli/src/build/plugins/postcssUrl.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/remax-cli/src/build/plugins/postcssUrl.ts b/packages/remax-cli/src/build/plugins/postcssUrl.ts index 279e07b11..66669d77b 100644 --- a/packages/remax-cli/src/build/plugins/postcssUrl.ts +++ b/packages/remax-cli/src/build/plugins/postcssUrl.ts @@ -6,6 +6,7 @@ import { RemaxOptions } from '../../getConfig'; interface Asset { url: string; + absolutePath: string; } export default (options: RemaxOptions) => @@ -25,6 +26,12 @@ export default (options: RemaxOptions) => }); } }); + if (!/^\//.test(asset.url)) { + return `/${path.relative( + path.resolve(options.cwd, 'src'), + asset.absolutePath + )}`; + } return asset.url; }, basePath: path.resolve(options.cwd, 'src'),