主题
sassOptions
sassOptions 允许你配置 Sass 编译器。
¥sassOptions allow you to configure the Sass compiler.
ts
import type { NextConfig } from 'next'
const sassOptions = {
additionalData: `
$var: red;
`,
}
const nextConfig: NextConfig = {
sassOptions: {
...sassOptions,
implementation: 'sass-embedded',
},
}
export default nextConfig需要了解:
¥Good to know:
sassOptions不在implementation之外输入,因为 Next.js 不维护其他可能的属性。¥
sassOptionsare not typed outside ofimplementationbecause Next.js does not maintain the other possible properties.用于定义自定义 Sass 函数的
functions属性仅在 webpack 中受支持。使用 Turbopack 时,自定义 Sass 函数不可用,因为 Turbopack 基于 Rust 的架构无法直接执行通过此选项传递的 JavaScript 函数。¥The
functionsproperty for defining custom Sass functions is only supported with webpack. When using Turbopack, custom Sass functions are not available because Turbopack's Rust-based architecture cannot directly execute JavaScript functions passed through this option.