You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This documents the option to use Dart Sass, and encourages users to
explicitly choose their implementation, but it doesn't change the
existing behavior.
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+2-7
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,10 @@
1
1
# Contributing to Gulp Sass
2
2
3
-
`gulp-sass` is a very light-weight wrapper around either [Dart Sass][] or [Node Sass][] (which in turn is a Node binding for [LibSass][]. All of these are implementations of the [Sass][] language.
4
-
5
-
[Dart Sass]: http://sass-lang.com/dart-sass
6
-
[Node Sass]: https://github.com/sass/node-sass
7
-
[LibSass]: https://sass-lang.com/libsass
8
-
[Sass]: https://sass-lang.com
3
+
Gulp Sass is a very light-weight [Gulp](https://github.com/gulpjs/gulp) wrapper for [`node-sass`](https://github.com/sass/node-sass), which in turn is a Node binding for [`libsass`](https://github.com/sass/libsass), which in turn is a port of [`Sass`](https://github.com/sass/sass).
9
4
10
5
## Submitting Issues
11
6
12
-
* Before creating a new issue, perform a [cursory search](https://github.com/issues?utf8=%E2%9C%93&q=repo%3Adlmanning%2Fgulp-sass+repo%3Asass%2Fdart-sass+repo%3Asass%2Fnode-sass+repo%3Asass%2Flibsass+repo%3Asass%2Fsass+repo%3Asass-eyeglass%2Feyeglass) in the Gulp Sass, Dart Sass, Node Sass, Libsass, and main Sass repos to see if a similar issue has already been submitted. Please also refer to our [Common Issues and Their Fixes](https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes) page for some basic troubleshooting.
7
+
* Before creating a new issue, perform a [cursory search](https://github.com/issues?utf8=%E2%9C%93&q=repo%3Adlmanning%2Fgulp-sass+repo%3Asass%2Fnode-sass+repo%3Asass%2Flibsass+repo%3Asass%2Fsass+repo%3Asass-eyeglass%2Feyeglass) in the Gulp Sass, Node Sass, Libsass, and main Sass repos to see if a similar issue has already been submitted. Please also refer to our [Common Issues and Their Fixes](https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes) page for some basic troubleshooting.
13
8
* You can create an issue [here](https://github.com/dlmanning/gulp-sass/issues). Please include as many details as possible in your report.
14
9
* Issue titles should be descriptive, explaining at the high level what it is about.
15
10
* Please include the version of `gulp-sass`, Node, and NPM you are using, as well as what operating system you are having a problem on.
Copy file name to clipboardexpand all lines: README.md
+16-10
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Only [Active LTS and Current releases][1] are supported.
13
13
# Install
14
14
15
15
```
16
-
npm install sass gulp-sass --save-dev
16
+
npm install node-sass gulp-sass --save-dev
17
17
```
18
18
19
19
# Basic Usage
@@ -24,7 +24,9 @@ Something like this will compile your Sass files:
24
24
'use strict';
25
25
26
26
var gulp =require('gulp');
27
-
var sass =require('gulp-sass')(require('sass'));
27
+
var sass =require('gulp-sass');
28
+
29
+
sass.compiler=require(node-sass');
28
30
29
31
gulp.task('sass', function () {
30
32
return gulp.src('./sass/**/*.scss')
@@ -43,7 +45,9 @@ You can also compile synchronously, doing something like this:
43
45
'use strict';
44
46
45
47
var gulp = require('gulp');
46
-
var sass =require('gulp-sass')(require('sass'));
48
+
var sass = require('gulp-sass');
49
+
50
+
sass.compiler = require(node-sass');
47
51
48
52
gulp.task('sass', function () {
49
53
returngulp.src('./sass/**/*.scss')
@@ -56,14 +60,21 @@ gulp.task('sass:watch', function () {
56
60
});
57
61
```
58
62
63
+
You can choose whether to use [Dart Sass][] or [Node Sass][] by setting the `sass.compiler` property. Node Sass will be used by default, but it's strongly recommended that you set it explicitly for forwards-compatibility in case the default ever changes.
64
+
65
+
[Dart Sass]: http://sass-lang.com/dart-sass
66
+
[Node Sass]: https://github.com/sass/node-sass
67
+
59
68
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:
60
69
61
70
```javascript
62
71
'use strict';
63
72
64
73
var Fiber =require('fibers');
65
74
var gulp =require('gulp');
66
-
var sass =require('gulp-sass')(require('sass'));
75
+
var sass =require('gulp-sass');
76
+
77
+
sass.compiler=require('sass');
67
78
68
79
gulp.task('sass', function () {
69
80
returngulp.src('./sass/**/*.scss')
@@ -78,11 +89,6 @@ gulp.task('sass:watch', function () {
78
89
79
90
## Options
80
91
81
-
`gulp-sass` supports both [Dart Sass][] and [Node Sass][]. You choose which one to use by writing either `require('gulp-sass')(require('sass'))` for Dart Sass or `require('gulp-sass')(require('node-sass'))` for Node Sass. One or the other must be passed in.
82
-
83
-
[Dart Sass]: http://sass-lang.com/dart-sass
84
-
[Node Sass]: https://github.com/sass/node-sass
85
-
86
92
Pass in options just like you would for [Node Sass](https://github.com/sass/node-sass#options); they will be passed along just as if you were using Node Sass. Except for the `data` option which is used by gulp-sass internally. Using the `file` option is also unsupported and results in undefined behaviour that may change without notice.
87
93
88
94
For example:
@@ -136,7 +142,7 @@ gulp.task('sass', function () {
136
142
137
143
# Issues
138
144
139
-
`gulp-sass` is a very light-weight wrapper around either [Dart Sass][] or [Node Sass][] (which in turn is a Node binding for [LibSass][]. Because of this, the issue you're having likely isn't a `gulp-sass` issue, but an issue with one those projects or with [Sass][] as a whole.
145
+
`gulp-sass` is a very light-weight wrapper around either [Dart Sass][] or [Node Sass][] (which in turn is a Node binding for [LibSass][]). Because of this, the issue you're having likely isn't a `gulp-sass` issue, but an issue with one those projects or with [Sass][] as a whole.