LegacyAsyncImporter
LegacyAsyncImporter: ((this: LegacyImporterThis, url: 字串, prev: 字串, done: ((result: LegacyImporterResult) => void)) => void)
類型宣告
-
- (this: LegacyImporterThis, url: 字串, prev: 字串, done: ((result: LegacyImporterResult) => void)): void
-
參數
-
this: LegacyImporterThis
-
url: string
@use
或@import
規則的網址字串,與其在樣式表中出現的樣子完全相同。 -
prev: string
用於識別包含
@use
或@import
規則的樣式表的字串。此字串的格式取決於該樣式表的載入方式。- 如果樣式表是從檔案系統載入的,則此字串為其檔案的絕對路徑。
- 如果樣式表是從回傳其內容的 importer 載入的,則此字串為載入它的
@use
或@import
規則的網址。 - 如果樣式表來自 data 選項,則此字串為 "stdin"。
-
done: ((result: LegacyImporterResult) => void)
importer 執行完成後要呼叫的回呼函式。
-
- (result: LegacyImporterResult): void
-
參數
-
result: LegacyImporterResult
回傳 void
-
-
回傳 void
-
這是一個非同步回呼函式,它實作了針對
@import
規則 和@use
規則 的客製 Sass 載入邏輯。它可以作為 importer 參數傳遞給 render 或 renderSync。非同步 importer 必須回傳
undefined
,然後在其 LegacyImporterResult 執行完成後,呼叫done
並傳入結果。更多詳細文件,請參閱 importer。
已棄用 (Deprecated)
這僅適用於舊版 render 和 renderSync API。請改用 Importer 搭配 compile、compileString、compileAsync 和 compileStringAsync。