Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/grunt-sass
Compile Sass to CSS
https://github.com/sindresorhus/grunt-sass
Last synced: about 1 month ago
JSON representation
Compile Sass to CSS
- Host: GitHub
- URL: https://github.com/sindresorhus/grunt-sass
- Owner: sindresorhus
- License: mit
- Created: 2012-06-12T18:24:30.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2022-07-08T11:35:47.000Z (over 2 years ago)
- Last Synced: 2024-04-14T01:30:22.170Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 111 KB
- Stars: 1,016
- Watchers: 43
- Forks: 209
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
- Security: .github/security.md
Awesome Lists containing this project
README
# grunt-sass
[](https://sass-lang.com)
> Compile Sass to CSS using [Dart Sass][] or [Node Sass][].
[Dart Sass]: http://sass-lang.com/dart-sass
[Node Sass]: https://github.com/sass/node-sassBefore filing an issue with this repository, please consider:
* Asking support questions on Use [Stack Overflow][].
* Reporting issues with the output on the [Dart Sass][Dart Sass issues] or [LibSass][LibSass issues] issue trackers, depending which implementation you're using.
* Reporting installation issues on the [Dart Sass][Dart Sass issues] or [Node Sass][Node Sass issues] issue trackers, depending on which implementation you're using.
[Stack Overflow]: https://stackoverflow.com/questions/tagged/node-sass
[Dart Sass issues]: https://github.com/sass/dart-sass/issues/new
[LibSass issues]: https://github.com/sass/libsass/issues/new
[Node Sass issues]: https://github.com/sass/node-sass/issues/new## Install
```
$ npm install --save-dev node-sass grunt-sass
```## Usage
```js
const sass = require('node-sass');require('load-grunt-tasks')(grunt);
grunt.initConfig({
sass: {
options: {
implementation: sass,
sourceMap: true
},
dist: {
files: {
'main.css': 'main.scss'
}
}
}
});grunt.registerTask('default', ['sass']);
```You can choose whether to use [Dart Sass][] or [Node Sass][] by passing the module to the `implementation` option. One implementation or the other *must* be passed.
Note that when using Dart Sass, **synchronous compilation is twice as fast as asynchronous compilation** by default, due to the overhead of asynchronous callbacks. To avoid this overhead, you can use the [`fibers`](https://www.npmjs.com/package/fibers) package to call asynchronous importers from the synchronous code path. To enable this, pass the `Fiber` class to the `fiber` option:
```js
const Fiber = require('fibers');
const sass = require('sass');require('load-grunt-tasks')(grunt);
grunt.initConfig({
sass: {
options: {
implementation: sass,
fiber: Fiber,
sourceMap: true
},
dist: {
files: {
'main.css': 'main.scss'
}
}
}
});grunt.registerTask('default', ['sass']);
```Files starting with `_` are ignored to match the expected [Sass partial behaviour](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#partials).
## Options
See the Node Sass [options](https://github.com/sass/node-sass#options), except for `file`, `outFile`, `success`, `error`.
The default value for the `precision` option is `10`, so you don't have to change it when using Bootstrap.