LegacySharedOptions<sync>

Options for render and renderSync that are shared between LegacyFileOptions and LegacyStringOptions.

Deprecated

This only works with the legacy render and renderSync APIs. Use Options with compile, compileString, compileAsync, and compileStringAsync instead.

Type Parameters

Hierarchy

Input

includePaths?: string[]
Compatibility (SASS_PATH):
Dart Sass
since 1.15.0
Node Sass
since 3.9.0

Earlier versions of Dart Sass and Node Sass didn’t support the SASS_PATH environment variable.

This array of strings option provides load paths for Sass to look for stylesheets. Earlier load paths will take precedence over later ones.

sass.renderSync({
file: "style.scss",
includePaths: ["node_modules/bootstrap/dist/css"]
});

Load paths are also loaded from the SASS_PATH environment variable, if it’s set. This variable should be a list of paths separated by ; (on Windows) or : (on other operating systems). Load paths from the includePaths option take precedence over load paths from SASS_PATH.

$ SASS_PATH=node_modules/bootstrap/dist/css sass style.scss style.css

Output

charset?: boolean
Compatibility:
Dart Sass
since 1.39.0
Node Sass

By default, if the CSS document contains non-ASCII characters, Sass adds a @charset declaration (in expanded output mode) or a byte-order mark (in compressed mode) to indicate its encoding to browsers or other consumers. If charset is false, these annotations are omitted.

indentType?: "space" | "tab"
Compatibility:
Dart Sass
Node Sass
since 3.0.0

Whether the generated CSS should use spaces or tabs for indentation.

const result = sass.renderSync({
file: "style.scss",
indentType: "tab",
indentWidth: 1
});

result.css.toString();
// "h1 {\n\tfont-size: 40px;\n}\n"

Default Value

'space'

indentWidth?: number
Compatibility:
Dart Sass
Node Sass
since 3.0.0

How many spaces or tabs (depending on indentType) should be used per indentation level in the generated CSS. It must be between 0 and 10 (inclusive).

Default Value

2