gulp-sass/README.md

73 lines
1.4 KiB
Markdown
Raw Normal View History

2013-08-31 23:01:20 +02:00
gulp-sass
=========
2013-09-01 06:54:25 +02:00
SASS plugin for [gulp](https://github.com/wearefractal/gulp).
#Install
```
npm install gulp-sass
```
#Basic Usage
2013-09-01 06:54:25 +02:00
Something like this:
```javascript
var gulp = require('gulp');
var sass = require('gulp-sass')
gulp.task('sass', function () {
2013-12-04 18:36:46 +01:00
gulp.src('./scss/*.scss')
2013-09-01 06:54:25 +02:00
.pipe(sass())
.pipe(gulp.dest('./css'));
});
```
2014-01-13 07:27:45 +01:00
Options passed as a hash into `sass()` will be passed along to [`node-sass`](https://github.com/andrew/node-sass)
## gulp-sass specific options
#### `errLogToConsole`
If you pass `errLogToConsole: true` into the options hash, sass errors will be logged to the console instead of generating a `gutil.PluginError` object. Use this option with `gulp.watch` to keep gulp from stopping every time you mess up your sass.
2013-09-01 06:54:25 +02:00
#Imports and Partials
2014-01-13 07:27:45 +01:00
If you want to use imports or partials, you'll need to pass the `includePaths` option along to node-sass. So if you have files like this:
scss/includes/_settings.scss:
```scss
$blue: #3bbfce;
$margin: 16px;
```
scss/style.scss:
```scss
@import "settings";
.content-navigation {
border-color: $blue;
color:
darken($blue, 9%);
}
.border {
padding: $margin / 2;
margin: $margin / 2;
border-color: $blue;
}
```
Your code should look something like this:
```javascript
gulp.task('sass', function () {
gulp.src('./scss/*.scss')
.pipe(sass({includePaths: ['scss/includes']}))
.pipe(gulp.dest('./css'));
});
```