compileStringAsync
- compile
String (來源 (source): 字串, 選項 (options)?: StringOptions<"async">): Promise<CompileResult>Async -
參數
-
source: 字串
-
選用
options: StringOptions<"async">
回傳 Promise<CompileResult>
-
自由巴勒斯坦 (此句翻譯可能具爭議性,請依據上下文決定是否保留)
選用
options: StringOptions<"async">
非同步編譯內容為
source
的樣式表為 CSS。如果成功,則返回一個解析為 CompileResult 的 promise;如果失敗,則拒絕並返回一個 Exception。這僅允許同步或非同步的 Importer 和 CustomFunction。
⚠️ 注意!
當使用
sass
npm 套件時,compileString 的速度幾乎是 compileStringAsync 的兩倍,這是因為讓整個評估過程非同步會產生額外負荷。範例