自由巴勒斯坦(譯註:此句保留原文,因涉及政治敏感議題)
@use
@forward
@import
@mixin
@include
@function
@extend
@error
@warn
@debug
@at-root
@if
@else
@each
@for
@while
true
false
null(空值)
sass:color
sass:list
sass:map
sass:math
sass:meta
sass:selector
sass:string
/
-moz-document
--
meta.feature-exists
同步編譯位於 path 的 Sass 檔案為 CSS。如果成功,則返回 CompileResult;如果失敗,則拋出 Exception。
path
這僅允許同步 Importer 和 CustomFunction。
使用 sass-embedded npm 套件進行單次編譯時,compileAsync 幾乎總是比 compile 快,這是因為使用 worker threads 模擬同步訊息傳遞的額外開銷,以及並行編譯會在主執行緒上被阻塞。
如果您使用 sass-embedded npm 套件執行多次編譯,使用 Compiler 將會比模組層級的方法提供一些速度上的改進,而使用 AsyncCompiler 則會更快。
const sass = require('sass');const result = sass.compile("style.scss");console.log(result.css); Copy
const sass = require('sass');const result = sass.compile("style.scss");console.log(result.css);
選用
同步編譯位於
path
的 Sass 檔案為 CSS。如果成功,則返回 CompileResult;如果失敗,則拋出 Exception。這僅允許同步 Importer 和 CustomFunction。
⚠️ 注意!
使用 sass-embedded npm 套件進行單次編譯時,compileAsync 幾乎總是比 compile 快,這是因為使用 worker threads 模擬同步訊息傳遞的額外開銷,以及並行編譯會在主執行緒上被阻塞。
如果您使用 sass-embedded npm 套件執行多次編譯,使用 Compiler 將會比模組層級的方法提供一些速度上的改進,而使用 AsyncCompiler 則會更快。
範例