# @bigcommerce/node-sass 中文文档

规范地址：https://npmcn.com/package/%40bigcommerce/node-sass/

版本：10\.0\.2
npm 元数据更新时间：2026-10-13T23:32:59.264Z
中文译文更新时间：2026-11-08T02:19:36.905Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40bigcommerce/node-sass
原文对照：https://npmcn.com/package/%40bigcommerce/node-sass/?lang=original
项目主页：https://github.com/bigcommerce-labs/node-sass
源码仓库：https://github.com/bigcommerce-labs/node-sass

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：6.9 MB，336 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>=20
- 运行依赖：14 个
- 首次发布：2025-10-30T20:30:52.392Z
- 最新版本发布：2025-11-04T15:04:20.882Z
- 近 30 天下载量：6173（2026-10-08 至 2026-11-06，npm 官方下载统计）
- 已发布版本数：3（近 12 个月 0 个）

## 中文简介

环绕自来水

## 安装

```sh
npm install @bigcommerce/node-sass
```

也可以使用：`pnpm add @bigcommerce/node-sass`、`yarn add @bigcommerce/node-sass`、`bun add @bigcommerce/node-sass`

## README

# 节点ass

这是一个被维护的节点-sass分叉,最初由节点-sass团队所创建.

## 节点版本支持策略

1.  支持的Node.js版本因发布而异,请参考 [页 次](https://github.com/sass/node-sass/releases)。 。 。 .
2.  命中末端的节点版本 [https://github.com/nodejs/放行 (英语)](https://github.com/nodejs/Release),将在每次节点ass放出(主要,次要)时从支持中去掉.
3.  我们将停止为无支持的释放建立二进制,在依赖兼容性方面测试断裂,但我们不会阻挡那些想要支持自己的人的安装.
4.  新的节点发布需要小的内部修改,同时需要CI提供者的支持(AppVeyor, GitHub Actions). 我们将开放一个单一问题,供有关各方同意并解决其他问题.

以下是最小和最大支持的节点ass版本的快速指南:

| 节点JS | 支持的节点ass版本 | 节点模块 |
| --- | --- | --- |
| 节点 20 | 9.0+ (中文(简体) ) | 115 (韩语) |
| 节点19 | 8.0+ (中文(简体) ) | 页:1 |
| 节点 18 | 8.0+ (中文(简体) ) | 108国 |
| 节点17 | 7.0+, < 8.0\] (中文(简体) ) | 102 (韩语) |
| 节点 16 | 6.0+ (中文(简体) ) | 93国道 |
| 节点15 | 5.0+,小于7.0 | 88国道 |
| 节点14 | 4.14+, < 9.0\] (中文(简体) ) | 83个 |
| 节点13 | 4.13+, < 5.0 | 页:1 |
| 节点 12 | 4.12+,小于8.0个 | 72国 |
| 节点 11 | 4.10+, < 5.0 | 67国道 |
| 节点 10 | 4.9+,小于 6.0 键 | 64国道 |
| 节点 8 | 4.5.3 +, < 5.0 | 页:1 |
| 节点 < 8 | < 5.0 时 | < 57 个 |

<table><tbody><tr><td><img alt="Sass logo" src="https://rawgit.com/sass/node-sass/master/media/logo.svg" width="77px" loading="lazy" decoding="async" referrerpolicy="no-referrer"></td><td align="right"><a href="https://www.npmjs.com/package/node-sass" rel="nofollow noopener noreferrer"><img src="https://nodei.co/npm/node-sass.png?downloads=true&amp;downloadRank=true&amp;stars=true" width="100%" loading="lazy" decoding="async" referrerpolicy="no-referrer"></a></td></tr></tbody></table>

![Alpine](https://github.com/sass/node-sass/workflows/Build%20bindings%20for%20Alpine%20releases/badge.svg) ![Linux](https://github.com/sass/node-sass/workflows/Build%20bindings%20for%20Linux%20releases/badge.svg) ![macOS](https://github.com/sass/node-sass/workflows/Build%20bindings%20for%20macOS%20releases/badge.svg) ![Windows x64](https://github.com/sass/node-sass/workflows/Build%20bindings%20for%20Windows%20releases/badge.svg) ![Linting](https://github.com/sass/node-sass/workflows/Lint%20JS/badge.svg) [![Windows x86](https://ci.appveyor.com/api/projects/status/22mjbk59kvd55m9y/branch/master?svg=true)](https://ci.appveyor.com/project/sass/node-sass/branch/master) [![Coverage Status](https://coveralls.io/repos/sass/node-sass/badge.svg?branch=master)](https://coveralls.io/r/sass/node-sass?branch=master)

节点ass是一个为节点提供约束的库.js to [属性](https://github.com/sass/libsass), C 版本的流行样式表预处理器, Sass.

它允许您以不可思议的速度在本地编译.css文件到cs,并通过连接中件自动编译.

在npm上发现: [https://www.npmjs.com/package/node-sass (中文(简体) )](https://www.npmjs.com/package/node-sass)

在推特上跟随@nodesass [https://twitter.com/nodesass 页面存档备份,存于互联网档案馆](https://twitter.com/nodesass)

## 安装

```shell
npm install node-sass
```

一些用户报告了在Ubuntu上安装的问题,原因是 `node` 正在注册到另一个软件包. [跟随官方的节点JS文件](https://github.com/nodesource/distributions/blob/master/README.md#debinstall) 以安装节点JS `#!/usr/bin/env node` 正确的解决.

在 Windows 机器上编译需要 [节点- 吉普先决条件](https://github.com/nodejs/node-gyp#on-windows)。 。 。 .

您是否看到以下错误 ? 看看我们 [解决问题指南](https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md#installing-node-sass-4x-with-node--4)∗∗ 载于A/AC.96/11号文件

```
SyntaxError: Use of const in strict mode.
```

**安装有问题吗? 看看我们 [解决问题指南](https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md)。 。 。 .**

### 从中国镜像安装

```shell
npm install -g mirror-config-china --registry=https://registry.npmmirror.com
npm install node-sass
```

## 使用量

```javascript
var sass = require('node-sass');
sass.render({
  file: scss_filename,
  [, options..]
}, function(err, result) { /*...*/ });
// OR
var result = sass.renderSync({
  data: scss_content
  [, options..]
});
```

## 选项

### 文件

-   类型 : `String`
-   默认 : `null`

**特别**数字 : `file` 或者说 `data` 必须指定

文件路径 [属性](https://github.com/sass/libsass) 要编译.

### 数据

-   类型 : `String`
-   默认 : `null`

**特别**数字 : `file` 或者说 `data` 必须指定

要传递的字符串 [属性](https://github.com/sass/libsass) 要编译。 建议您使用 `includePaths` 与此相关联,以便 [属性](https://github.com/sass/libsass) 使用时可以找到文件 `@import` 指令.

### 进口商(xq v 2. 0.0) - _实验_

**这是LibSass的实验性特征. 谨慎使用.**

-   类型 : `Function | Function[]` 签名 `function(url, prev, done)`
-   默认 : `undefined`

函数参数和信息:

-   `url (String)` - 导入路径 **作为**,哪个 [属性](https://github.com/sass/libsass) 遇到
-   `prev (String)` - 先前解决的路径
-   `done (Function)` - 调用函数以引用 aync 补全,取一个包含
    -   `file (String)` - 用于 [属性](https://github.com/sass/libsass) 用于 **或**
    -   `contents (String)` - 所导入的内容(例如从内存或文件系统读取)

何时处理 [属性](https://github.com/sass/libsass) 遇到 `@import` 指令。 自定义进口商允许扩展 [属性](https://github.com/sass/libsass) 以同步和同步方式运行的引擎。 在这两种情况下,目标是 `return` 或打电话 `done()` 以对象字形表示。 根据物体字面值的不同,将发生两件事之一.

返回或呼叫时 `done()` 与 `{ file: "String" }`,则将假设为 `@import`。建议注意: `prev` 在可能需要相对路径解析的情况下.

返回或呼叫时 `done()` 与 `{ contents: "String" }`,字符串值将用作文件通过外部来源读取.

从 v3. 0.0 开始 :

-   `this` 是指直接运行时的背景范围 `sass.render` 或者说 `sass.renderSync`
    
-   导入者可以返回错误, LibSass 将发出错误作为回应 。 例如:
    
    ```javascript
    done(new Error('doesn\'t exist!'));
    // or return synchronously
    return new Error('nothing to do here');
    ```
    
-   导入器可以是一系列函数,LibSass会按其发生于数组的顺序调用. 这有助于用户指定特定类型路径的特殊导入者(文件系统,http). 如果进口商不想处理某一特定路径,则应返回 `null`。见 [职能科](https://npmcn.com/package/%40bigcommerce/node-sass/#readme-functions--v300---experimental) 更多关于Sass类型的细节.
    

### 函数 (qqv3. 0.0) - _实验_

**这是LibSass的实验性特征. 谨慎使用.**

`functions` 是一个 `Object` 包含一组自定义函数,这些函数可由正在编译的 sass 文件引用。 它们可能取出零或更多输入参数,必须同步返回一个值(`return ...;`)或同步(`done();`) (中文(简体) ). 这些参数将是载于《建筑手册》的施工者之一的例子 `require('node-sass').types` 散货 返回值也必须是其中之一。 见下文现有类型清单:

#### 类型

-   `getValue()`编号 : `setValue(value)` : 获得/设置数字的数字部分
-   `getUnit()` 编号 : `setUnit(unit)` : 获得/ 设置数字的单位部分

#### 类型. String(值)

-   `getValue()` 编号 : `setValue(value)` : 获取/ 设置被绑定的字符串

#### 类型。 颜色(r, g, b \[, a = 1.0\])或类型. 颜色( argb)

-   `getR()` 编号 : `setR(value)` : 红色组件(整数来自 `0` 改为 `255`(中文(简体) )
-   `getG()` 编号 : `setG(value)` : 绿色组件(整数来自 `0` 改为 `255`(中文(简体) )
-   `getB()` 编号 : `setB(value)` : 蓝色组件(整数来自 `0` 改为 `255`(中文(简体) )
-   `getA()` 编号 : `setA(value)` : alpha 组件(数字来自 `0` 改为 `1.0`(中文(简体) )

示例

```javascript
var Color = require('node-sass').types.Color,
  c1 = new Color(255, 0, 0),
  c2 = new Color(0xff0088cc);
```

#### 类型。Boolean(值)

-   `getValue()` : 获取附件布尔
-   `types.Boolean.TRUE` : Singleton 实例 `types.Boolean` 持有"真理"
-   `types.Boolean.FALSE` : Singleton 实例 `types.Boolean` 写着"假"

#### 类型.List(长 \[,逗号分隔符=正 )

-   `getValue(index)` 编号 : `setValue(index, value)` 数字 : `value` 本身必须是建造者之一的例子 `sass.types`。 。 。 .
-   `getSeparator()` 编号 : `setSeparator(isComma)` : 是否使用逗号作为分隔符
-   `getLength()`

#### 类型

-   `getKey(index)` 编号 : `setKey(index, value)`
-   `getValue(index)` 编号 : `setValue(index, value)`
-   `getLength()`

#### 类型

-   `types.Null.NULL` : Singleton 实例 `types.Null`。 。 。 .

#### 示例

```javascript
sass.renderSync({
  data: '#{headings(2,5)} { color: #08c; }',
  functions: {
    'headings($from: 0, $to: 6)': function(from, to) {
      var i, f = from.getValue(), t = to.getValue(),
          list = new sass.types.List(t - f + 1);

      for (i = f; i <= t; i++) {
        list.setValue(i - f, new sass.types.String('h' + i));
      }

      return list;
    }
  }
});
```

### 包括路径

-   类型 : `Array<String>`
-   默认 : `[]`

一系列路径 [属性](https://github.com/sass/libsass) 可以寻找 试图解决你的 `@import` 声明。 使用时 `data`,建议您使用这个.

### 缩进语法

-   类型 : `Boolean`
-   默认 : `false`

`true` 启用值 [Sass 缩进语法](https://sass-lang.com/documentation/file.INDENTED_SYNTAX.html) 用于解析数据字符串或文件.

**说明:** 节点-sass/libsass会编译一个混合库来编译 scs和缩进的语法(.sass)文件,并设置默认设置(false),只要.sass和.scs扩展在文件名中使用.

### 缩进Type( QQ v3. 0.0)

-   类型 : `String`
-   默认 : `space`

用于确定是使用空格还是制表符来缩进 .

### 缩进Width( QQ v3. 0.0)

-   类型 : `Number`
-   默认 : `2`
-   最大数 : `10`

用于确定用于缩进的空格或标签数量.

### 线条feed (>= v3. 0.0)

-   类型 : `String`
-   默认 : `lf`

用于决定是否使用 `cr`, (中文(简体) ), `crlf`, (中文(简体) ), `lf` 或者说 `lfcr` 换行序列.

### 删除 SourceMapUrl

-   类型 : `Boolean`
-   默认 : `false`

**特殊 :** 当使用时,您还应当指定 `outFile` 避免出乎意料的行为.

`true` 值会禁用输出文件中包含源地图信息.

### 输出文件

-   类型 : `String | null`
-   默认 : `null`

**特殊 :** 需要时间 `sourceMap` 是真实值

指定输出文件的预定位置。 强烈地建议在输出出源地图时,使其能正确回溯到预定文件.

**请注意** 启用此选项 **没有** 在磁盘上为您写入文件,仅用于内部参考目的(例如生成地图).

如何在磁盘上写入的示例

```javascript
sass.render({
    ...
    outFile: yourPathTotheFile,
  }, function(error, result) { // node-style callback from v3.0.0 onwards
    if(!error){
      // No errors during the compilation, write this result on the disk
      fs.writeFile(yourPathTotheFile, result.css, function(err){
        if(!err){
          //file written on disk
        }
      });
    }
  });
});
```

### 输出样式

-   类型 : `String`
-   默认 : `nested`
-   数值 : `nested`, (中文(简体) ), `expanded`, (中文(简体) ), `compact`, (中文(简体) ), `compressed`

确定 CSS 最终样式的输出格式.

### 精确度

-   类型 : `Integer`
-   默认 : `5`

用于确定小数点后允许多少位数字 。 例如,如果你有小数 `1.23456789` 准确性 `5`,结果将是 `1.23457` 在最终的CSS.

### 来源注释

-   类型 : `Boolean`
-   默认 : `false`

`true` 启用指定向编译的 CSS 中释放的选择器的行号和文件作为注释 。 可用于调试,特别是在使用进口和混合时.

### 来源映射

-   类型 : `Boolean | String | undefined`
-   默认 : `undefined`

启用源映射生成 `render` 财务报告和审定财务报表 `renderSync`。 。 。 .

何时 `sourceMap === true`,该值为 `outFile` 用作带有后缀的源图的目标输出位置 `.map` 附录。 若无 `outFile` 已经设定, `sourceMap` 参数被忽略.

何时 `typeof sourceMap === "string"`,该值为 `sourceMap` 将用作文件的写入位置.

### 源代码

-   类型 : `Boolean`
-   默认 : `false`

`true` 包括 `contents` 在源地图信息中

### 源代码

-   类型 : `Boolean`
-   默认 : `false`

`true` 将源地图嵌入为数据 URI

### 来源地图

-   类型 : `String`
-   默认 : `undefined`

该值将作为 `sourceRoot` 在源地图信息中

## `render` 回调( QQ v3. 0.0)

节点- ass 支持标准节点样式的同步调用, 并签名 `function(err, result)`在错误条件下 `error` 参数中含有错误对象。 在成功的条件下 `result` 对象中包含一个描述渲染调用结果的对象.

### 错误对象

-   `message` (String) - 错误消息.
-   `line` (数目) - 出错的行号.
-   `column` (数目) - 出错的列数.
-   `status` (数量) - 状态代码.
-   `file` (String) - 错误的文件名 。 以防万一 `file` 未设置选项(赞成) `data`),这将反映数值 `stdin`。 。 。 .

### 结果对象

-   `css` (Buffer) - 编译的CSS. 把这个写到档案里 或按需要发报.
-   `map` (Buffer) - 源地图
-   `stats` (Object) - 包含编译信息的对象. 它包含以下密钥:
    -   `entry` (String) - 通往 scs 文件的路径,或 `data` 如果来源不是文件
    -   `start` (数目) - 在汇编之前的日期.现在()
    -   `end` (数量) - 汇编后的日期.now()
    -   `duration` (数目) - _结束_ - 说吧 _开始_
    -   `includedFiles` (Array) - 绝对路径到所有相关的 scs 文件,没有特定的顺序.

### 实例

```javascript
var sass = require('node-sass');
sass.render({
  file: '/path/to/myFile.scss',
  data: 'body{background:blue; a{color:black;}}',
  importer: function(url, prev, done) {
    // url is the path in import as is, which LibSass encountered.
    // prev is the previously resolved path.
    // done is an optional callback, either consume it or return value synchronously.
    // this.options contains this options hash, this.callback contains the node-style callback
    someAsyncFunction(url, prev, function(result){
      done({
        file: result.path, // only one of them is required, see section Special Behaviours.
        contents: result.data
      });
    });
    // OR
    var result = someSyncFunction(url, prev);
    return {file: result.path, contents: result.data};
  },
  includePaths: [ 'lib/', 'mod/' ],
  outputStyle: 'compressed'
}, function(error, result) { // node-style callback from v3.0.0 onwards
  if (error) {
    console.log(error.status); // used to be "code" in v2x and below
    console.log(error.column);
    console.log(error.message);
    console.log(error.line);
  }
  else {
    console.log(result.css.toString());

    console.log(result.stats);

    console.log(result.map.toString());
    // or better
    console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too
  }
});
// OR
var result = sass.renderSync({
  file: '/path/to/file.scss',
  data: 'body{background:blue; a{color:black;}}',
  outputStyle: 'compressed',
  outFile: '/to/my/output.css',
  sourceMap: true, // or an absolute or relative (to outFile) path
  importer: function(url, prev, done) {
    // url is the path in import as is, which LibSass encountered.
    // prev is the previously resolved path.
    // done is an optional callback, either consume it or return value synchronously.
    // this.options contains this options hash
    someAsyncFunction(url, prev, function(result){
      done({
        file: result.path, // only one of them is required, see section Special Behaviours.
        contents: result.data
      });
    });
    // OR
    var result = someSyncFunction(url, prev);
    return {file: result.path, contents: result.data};
  }
});

console.log(result.css);
console.log(result.map);
console.log(result.stats);
```

### 特殊行为

-   如果两者兼有 `file` 财务报告和审定财务报表 `data` 选项设置,节点ass将优先使用 `data` 和使用情况 `file` 在源图中计算路径.

### 版本信息 (QQ v 2. 0

两者 `node-sass` 财务报告和审定财务报表 `libsass` 版本信息现在通过 `info` 方法 :

```javascript
var sass = require('node-sass');

console.log(sass.info);

/*
  it will output something like:

  node-sass       2.0.1   (Wrapper)       [JavaScript]
  libsass         3.1.0   (Sass Compiler) [C/C++]
*/
```

从节点 -sass >=v3.0.0起. LibSass版本在运行时确定.

## 一体化

列出社区在建设工具和框架中使用节点吸管的情况.

### 括号扩展名

[@ jasonsanjose (英语)](https://github.com/jasonsanjose) 创建了 [括号](http://brackets.io/) 基于节点ass的扩展名 : [https://github.com/jasonsanjose/brackets-sass (中文(简体) )](https://github.com/jasonsanjose/brackets-sass)。编辑 Sass 文件时,扩展会编辑保存时的更改。 扩展也与Live Preview集成,以显示浏览器中的 Sass 变化而无需保存或编译.

### 布鲁奇插件

[布鲁奇](http://brunch.io/)官方的sass插件默认使用节点-sass,如果检测到使用Compass,则自动倒回红宝石: [https://github.com/brunch/sass-brunch 互联网档案馆的存檔,存档日期2014-12-21](https://github.com/brunch/sass-brunch)

### 连接/ 执行中间软件

编译 `.scss` 用于连接和表达基于 http 服务器的文件.

此功能已移动到 [`node-sass-middleware`](https://github.com/sass/node-sass-middleware) 在节点-ass v1.0.0 中

### DocPad 插件

[@ 10xLaCroix 饮用器](https://github.com/10xLaCroixDrinker) 写了一个 [文档](http://docpad.org/) 编译插件 `.scss` 使用节点ass的文件 : [https://github.com/docpad/docpad-plugin-nodesass 页面存档备份,存于互联网档案馆](https://github.com/docpad/docpad-plugin-nodesass)

### Duo.js 扩展名

[@ stephenway (英语)](https://github.com/stephenway) 创建了一个扩展,将 Sass 转换为 CSS ,使用节点- sass 与 [双人](http://duojs.org/) [https://github.com/duojs/sass (中文(简体) )](https://github.com/duojs/sass)

### Grunt 扩展名

[@sindresorhus (英语)](https://github.com/sindresorhus/) 已经根据节点- sass 创建了一组 grunt 任务 : [https://github.com/sindresorhus/grunt-sass 互联网档案馆的存檔,存档日期2013-12-21](https://github.com/sindresorhus/grunt-sass)

### Gulp 扩展

[@dlmanning (英语)](https://github.com/dlmanning/) 基于节点- sass 创建了 gulp sass 插件 : [https://github.com/dlmanning/glulp-sass (中文(简体) )](https://github.com/dlmanning/gulp-sass)

### 枪声

[@ sintaxi](https://github.com/sintaxi)哈普网络服务器默认编译 `.scss` 使用节点ass的文件 : [https://github.com/sintaxi/harp (中文(简体) )](https://github.com/sintaxi/harp)

### 金属匠插件

[@史蒂文肖伯特](https://github.com/stevenschobert/) 基于节点- sass 创建了金属匠插件 : [https://github.com/stevenschobert/ 金属匠-驴子](https://github.com/stevenschobert/metalsmith-sass)

### 气象插件

[@ 四七](https://github.com/fourseven) 基于节点-ass创建了流星插件 : [https://github.com/ 四七/meteor-scs (中文(简体) )](https://github.com/fourseven/meteor-scss)

### 米莫萨模块

[@dbashford (英语)](https://github.com/dbashford) 创建了用于 sass 的 Mimosa 模块,其中包括 节点- sass : [https://github.com/dbashford/mimosa-ass 互联网档案馆的存檔,存档日期2014-12-21](https://github.com/dbashford/mimosa-sass)

## 示例应用

这里还有一个连接应用程序的例子: [https://github.com/andrew/node-sass-example (原始内容存档于2017-09-27)](https://github.com/andrew/node-sass-example)

## 重建二进制

节点-ass包括用于流行平台的预编译二进制,用于为您的平台添加二进制遵循这些步骤:

检查项目:

```bash
git clone --recursive https://github.com/sass/node-sass.git
cd node-sass
npm install
node scripts/build -f  # use -d switch for debug release
# if succeeded, it will generate and move
# the binary in vendor directory.
```

## 命令行接口

命令行使用的接口在此阶段相当简单,如下用法部分所见.

如果 `--output` 旗被省略.

### 使用量

`node-sass [options] <input> [output]` 或者说: `cat <input> | node-sass > output`

示例

`node-sass src/style.scss dest/style.css`

**选项 :**

```bash
    -w, --watch                Watch a directory or file
    -r, --recursive            Recursively watch directories or files
    -o, --output               Output directory
    -x, --omit-source-map-url  Omit source map URL comment from output
    -i, --indented-syntax      Treat data from stdin as sass code (versus scss)
    -q, --quiet                Suppress log output except on error
    -v, --version              Prints version info
    --output-style             CSS output style (nested | expanded | compact | compressed)
    --indent-type              Indent type for output CSS (space | tab)
    --indent-width             Indent width; number of spaces or tabs (maximum value: 10)
    --linefeed                 Linefeed style (cr | crlf | lf | lfcr)
    --source-comments          Include debug info in output
    --source-map               Emit source map
    --source-map-contents      Embed include contents in map
    --source-map-embed         Embed sourceMappingUrl as data URI
    --source-map-root          Base path, will be emitted in source-map as is
    --include-path             Path to look for imported files
    --follow                   Follow symlinked directories
    --precision                The amount of precision allowed in decimal numbers
    --error-bell               Output a bell character on errors
    --importer                 Path to .js file containing custom importer
    --functions                Path to .js file containing custom functions
    --help                     Print usage info
```

这个 `input` 可以是单人 `.scss` 或者说 `.sass`,或目录。 如果输入是目录,则 `--output` 还必须提供旗帜.

此外,说明 `--importer` 将(绝对或相对 pwd) 路径取入 js 文件, 需要默认 `module.exports` 设置为导入函数。 看我们的考验 [固定装置](https://github.com/sass/node-sass/tree/974f93e76ddd08ea850e3e663cfe64bb6a059dd3/test/fixtures/extras) 举个例子.

这个 `--source-map` 选项接受布尔值,在这种情况下,它以 `.css.map`。它也接受路径 `.map` 文件甚至想要的目录的路径. 编译目录时 `--source-map` 可以是布尔值,也可以是目录.

## 二进制配置参数

节点-ass支持不同的配置参数来改变与sass 二进制相关的设置,如二进制名称,二进制路径或替代下载路径等. 以下参数由节点-ass支持:

| 可变名称 | .npmrc 参数 | 进程参数 | 数值 |
| --- | --- | --- | --- |
| 萨斯克语 柏林 纳斯 | ass 二进制 name | \--ass-二进制名称 | 路径 |
| (原始内容存档于2018-09-31) (中文(简体) ). SASS | ass 二进制 site | \--ass-二进制网站 | 網址 |
| 萨斯巴达克语NAME | ass 二进制 path | \-- ass- 二进制路径 | 路径 |
| (简体中文) | ass 二进制 dir | \--ass- 二进制目录 | 路径 |
| 获得授权 | ass reject 未授权 | \--ass-reject-未授权 | 价值 |

这些参数可用作环境变量:

-   举个例子. `export SASS_BINARY_SITE=http://example.com/`

作为地方或全球 [.npmerc (英语)](https://docs.npmjs.com/misc/config) 配置文件 :

-   举个例子. `sass_binary_site=http://example.com/`

作为进程论据:

-   举个例子. `npm install node-sass --sass-binary-site=http://example.com/`

如果您正在使用自签名的证书进行二进制 `SASS_REJECT_UNAUTHORIZED` 将覆盖( 拒绝 ) \[[https://nodejs.org/docs/latest/api/tls.html#tls tls createserver options securityconnectionlistener 互联网档案馆的存檔,存档日期2014-12-11](https://nodejs.org/docs/latest/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)\[ \[ \] \[ \] \]. \].

## 安装后构建

安装只运行两个 Mocha 测试以查看您的机器能否使用预建的 [属性](https://github.com/sass/libsass) 这将在安装期间节省一些时间。 如果任何测试失败,它将从源头建立起来.

## 维护者

本单元由下列人员带给你并维护:

-   迈克尔·米夫苏德 - 项目领导([吉图布](https://github.com/xzyfer) 编号 : [微博](https://twitter.com/xzyfer)(中文(简体) )
-   安德鲁·内斯比特(Andrew Nesbitt)[吉图布](https://github.com/andrew) 编号 : [微博](https://twitter.com/teabass)(中文(简体) )
-   毛泽东([吉图布](https://github.com/deanmao) 编号 : [微博](https://twitter.com/deanmao)(中文(简体) )
-   布莱特·威尔金斯(英语:Brett Wilkins)[吉图布](https://github.com/bwilkins) 编号 : [微博](https://twitter.com/bjmaz)(中文(简体) )
-   基思·锡克尔(签名)[吉图布](https://github.com/keithamus) 编号 : [微博](https://twitter.com/Keithamus)(中文(简体) )
-   洛朗·戈德雷(签名)[吉图布](https://github.com/laurentgoderre) 编号 : [微博](https://twitter.com/laurentgoderre)(中文(简体) )
-   尼克·肖宁(英语:[吉图布](https://github.com/nschonni) 编号 : [微博](https://twitter.com/nschonni)(中文(简体) )
-   阿迪尔·穆贾希德(Adeel Mujahid)[吉图布](https://github.com/am11) 编号 : [微博](https://twitter.com/adeelbm)(中文(简体) )

## 贡献者

我们只有3个贡献者! 我们特别感谢所有那些在一段时间内在这个项目上工作的人,我们非常赞赏你的辛勤工作。 你们可以找到 [这些人的完整名单.](https://github.com/sass/node-sass/graphs/contributors)

### 关于补丁/ pulll 请求的说明

看看我们 [贡献指南](https://npmcn.com/.github/CONTRIBUTING.md)

## 版权

版权 (c)2015 安德鲁·内斯比特. 见 [自由主义](https://github.com/sass/node-sass/blob/master/LICENSE) 详细情况.

## 常见问题

### @bigcommerce/node-sass 是什么？

环绕自来水

### 如何安装 @bigcommerce/node-sass？

在项目目录运行 npm install @bigcommerce/node-sass，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 node-sass，可以用 npx node-sass 直接运行。

### @bigcommerce/node-sass 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/bigcommerce\_\_node-sass 是否存在。

### @bigcommerce/node-sass 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @bigcommerce/node-sass 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=20。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @bigcommerce/node-sass 可以商用吗？

@bigcommerce/node-sass 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @bigcommerce/node-sass 的下载量有多少？

根据 npm 官方下载统计，@bigcommerce/node-sass 在 2026/10/08 – 2026/11/06 这 30 天内被下载 6,173 次，日均约 206 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @bigcommerce/node-sass 还在维护吗？

最新版本 10\.0\.2 发布于 2025/11/04（1 年前）；至今共发布 3 个版本，其中过去 12 个月发布了 0 个；首次发布于 2025/10/31。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

