# grunt-contrib-sass

> Compile Sass to CSS

Latest version **2.0.0** (published 2020-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install grunt-contrib-sass
pnpm add grunt-contrib-sass
yarn add grunt-contrib-sass
bun add grunt-contrib-sass
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-08-20 |
| First published | 2012-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 5 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Grunt Team |
| Maintainers | cowboy, jmeas, shama, sindresorhus, tkellen, vladikoff |
| Keywords | gruntplugin, scss, sass, css, compile, preprocessor, style |

## Links

- npm: https://www.npmjs.com/package/grunt-contrib-sass
- Repository: https://github.com/gruntjs/grunt-contrib-sass
- Homepage: https://github.com/gruntjs/grunt-contrib-sass#readme
- Issues: https://github.com/gruntjs/grunt-contrib-sass/issues
- npm.io page: https://npm.io/package/grunt-contrib-sass

## Dependencies (5)

- [async](https://npm.io/package/async.md) ^2.6.1
- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [dargs](https://npm.io/package/dargs.md) ^6.0.0
- [which](https://npm.io/package/which.md) ^1.3.1
- [cross-spawn](https://npm.io/package/cross-spawn.md) ^6.0.5

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2020-08-20
- 1.0.0 — 2016-03-04
- 0.9.2 — 2015-02-07
- 0.9.1 — 2015-02-06
- 0.9.0 — 2015-02-06
- 0.8.1 — 2014-08-24
- 0.8.0 — 2014-08-21
- 0.7.4 — 2014-08-09
- 0.7.3 — 2014-03-06
- 0.7.2 — 2014-02-02
- 0.7.1 — 2014-01-28
- 0.2.2-rc7 — 2014-01-26
- 0.7.0 — 2014-01-26
- 0.6.0 — 2013-12-10
- 0.5.1 — 2013-11-22
- … 11 more at https://npm.io/package/grunt-contrib-sass/versions

## README

# grunt-contrib-sass v2.0.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-sass.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-sass) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/ugf9aop97slt5anb/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-sass/branch/master)

> Compile Sass to CSS



## Getting Started

If you haven't used [Grunt](https://gruntjs.com/) before, be sure to check out the [Getting Started](https://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](https://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-contrib-sass --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-contrib-sass');
```




## Sass task
_Run this task with the `grunt sass` command._

[Sass](http://sass-lang.com/) is a preprocessor that adds nested rules, variables, mixins and functions, selector inheritance, and more to CSS. Sass files compile into well-formatted, standard CSS to use in your site or application.

This task requires you to have [Ruby](http://www.ruby-lang.org/en/downloads/) and [Sass](http://sass-lang.com/install) installed. If you're on OS X or Linux you probably already have Ruby installed; test with `ruby -v` in your terminal. When you've confirmed you have Ruby installed, run `gem install sass` to install Sass.

Note: Files that begin with "_" are ignored even if they match the globbing pattern. This is done to match the expected [Sass partial behaviour](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#partials).

### Options


#### sourcemap

Type: `String`  
Default: `auto`

Values:

- `auto` - relative paths where possible, file URIs elsewhere
- `file` - always absolute file URIs
- `inline` - include the source text in the sourcemap
- `none`- no sourcemaps

**Requires Sass 3.4.0, which can be installed with `gem install sass`**


#### trace

Type: `Boolean`  
Default: `false`

Show a full traceback on error.


#### unixNewlines

Type: `Boolean`  
Default: `false` on Windows, otherwise `true`

Force Unix newlines in written files.


#### check

Type: `Boolean`  
Default: `false`

Just check the Sass syntax, does not evaluate and write the output.


#### style

Type: `String`  
Default: `nested`

Output style. Can be `nested`, `compact`, `compressed`, `expanded`.


#### precision

Type: `Number`  
Default: `5`

How many digits of precision to use when outputting decimal numbers.


#### quiet

Type: `Boolean`  
Default: `false`

Silence warnings and status messages during compilation.


#### compass

Type: `Boolean`  
Default: `false`

Make Compass imports available and load project configuration (`config.rb` located close to the `Gruntfile.js`).


#### debugInfo

Type: `Boolean`  
Default: `false`

Emit extra information in the generated CSS that can be used by the FireSass Firebug plugin.


#### lineNumbers

Type: `Boolean`  
Default: `false`

Emit comments in the generated CSS indicating the corresponding source line.


#### loadPath

Type: `String|Array`

Add a (or multiple) Sass import path.


#### require

Type: `String|Array`

Require a (or multiple) Ruby library before running Sass.


#### cacheLocation

Type: `String`  
Default: `.sass-cache`

The path to put cached Sass files.


#### noCache

Type: `Boolean`  
Default: `false`

Don't cache to sassc files.


#### bundleExec

Type: `Boolean`  
Default: `false`

Run `sass` with [bundle exec](https://bundler.io/man/bundle-exec.1.html): `bundle exec sass`.


#### update

Type: `Boolean`  
Default: `false`

Only compile changed files.

### Examples

#### Example config

```js
grunt.initConfig({
  sass: {                              // Task
    dist: {                            // Target
      options: {                       // Target options
        style: 'expanded'
      },
      files: {                         // Dictionary of files
        'main.css': 'main.scss',       // 'destination': 'source'
        'widgets.css': 'widgets.scss'
      }
    }
  }
});

grunt.loadNpmTasks('grunt-contrib-sass');

grunt.registerTask('default', ['sass']);
```

#### Compile

```js
grunt.initConfig({
  sass: {
    dist: {
      files: {
        'main.css': 'main.scss'
      }
    }
  }
});
```

#### Concat and compile

Instead of concatenating the files, just `@import` them into another `.sass` file eg. `main.scss`.


#### Compile multiple files

You can specify multiple `destination: source` items in `files`.

```js
grunt.initConfig({
  sass: {
    dist: {
      files: {
        'main.css': 'main.scss',
        'widgets.css': 'widgets.scss'
      }
    }
  }
});
```

#### Compile files in a directory

Instead of naming all files you want to compile, you can use the `expand` property allowing you to specify a directory. More information available in the [grunt docs](https://gruntjs.com/configuring-tasks) - `Building the files object dynamically`.

```js
grunt.initConfig({
  sass: {
    dist: {
      files: [{
        expand: true,
        cwd: 'styles',
        src: ['*.scss'],
        dest: '../public',
        ext: '.css'
      }]
    }
  }
});
```


## Release History

 * 2020-03-04   v2.0.0   Update dependencies. Now requires at least Node 8.
 * 2016-03-04   v1.0.0   Bump `chalk`. Update to docs and project structure.
 * 2015-02-06   v0.9.0   Remove `banner` option. Allow using `--force` to ignore compile errors. Increase concurrency count from `2` to `4`. Improve Windows support.
 * 2014-08-24   v0.8.1   Fix `check` option.
 * 2014-08-21   v0.8.0   Support Sass 3.4 Source Map option. Add `update` option.
 * 2014-08-09   v0.7.4   Fix `bundleExec` option. Fix `os.cpus()` issue. Log `sass` command when `--verbose` flag is set.
 * 2014-03-06   v0.7.3   Only create empty dest files when they don't already exist.
 * 2014-02-02   v0.7.2   Fix error reporting when Sass is not available.
 * 2014-01-28   v0.7.1   Fix regression of Bundler support.
 * 2014-01-26   v0.7.0   Improve Windows support.
 * 2013-12-10   v0.6.0   Ignore files where filename have leading underscore.
 * 2013-08-21   v0.5.0   Add `banner` option.
 * 2013-07-06   v0.4.1   Use `file.orig.src` if `file.src` does not exist and return early to avoid passing non-existent files to sass binary.
 * 2013-06-30   v0.4.0   Rewrite task to be able to support Source Maps. Compile Sass files in parallel for better performance.
 * 2013-03-26   v0.3.0   Add support for `bundle exec`. Make sure `.css` files are compiled with SCSS.
 * 2013-02-15   v0.2.2   First official release for Grunt 0.4.0.
 * 2013-01-25   v0.2.2rc7   Updating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
 * 2013-01-09   v0.2.2rc5   Updating to work with grunt v0.4.0rc5. Switching to `this.files` API. Add `separator` option.
 * 2012-11-05   v0.2.0   Grunt 0.4 compatibility. Improve error message when Sass binary couldn't be found
 * 2012-10-12   v0.1.3   Rename grunt-contrib-lib dep to grunt-lib-contrib.
 * 2012-10-08   v0.1.2   Fix regression for darwin.
 * 2012-10-05   v0.1.1   Windows support.
 * 2012-09-24   v0.1.0   Initial release.

---

Task submitted by [Sindre Sorhus](https://github.com/sindresorhus)

*This file was generated on Thu Aug 20 2020 12:31:17.*

---
_Source: https://npm.io/package/grunt-contrib-sass · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
