test | ||
.editorconfig | ||
.eslintrc | ||
.gitignore | ||
.npmignore | ||
.travis.yml | ||
CHANGELOG.md | ||
index.js | ||
LICENSE | ||
package.json | ||
README.md |
gulp-sass
Sass plugin for Gulp.
Install
npm install gulp-sass --save-dev
Basic Usage
Something like this:
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
gulp.task('sass', function () {
gulp.src('./scss/*.scss')
.pipe(sass().on('error', gutil.log))
.pipe(gulp.dest('./css'));
});
Options passed as a hash into sass()
will be passed along to node-sass
.
Source Maps
gulp-sass
can be used in tandem with gulp-sourcemaps to generate source maps for the Sass to CSS compilation. You will need to initialize gulp-sourcemaps prior to running gulp-sass
and write the source maps after.
var sourcemaps = require('gulp-sourcemaps');
gulp.src('./scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css'));
By default, gulp-sourcemaps writes the source maps inline in the compiled CSS files. To write them to a separate file, specify a relative file path in the sourcemaps.write()
function.
var sourcemaps = require('gulp-sourcemaps');
gulp.src('./scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./css'));
Issues
gulp-sass
is a very light-weight wrapper around node-sass
, which in turn is a Node binding for libsass
, which in turn is a port of Sass
. Because of this, the issue you're having likely isn't a gulp-sass
issue, but an issue with one of those three projects.
If you have a feature request/question how Sass works/concerns on how your Sass gets compiled/errors in your compiling, it's likely a libsass
or Sass
issue and you should file your issue with one of those projects.
If you're having problems with the options you're passing in, it's likely a node-sass
or libsass
issued and you should file your issue with one of those projects.
We may, in the course of resolving issues, direct you to one of these other projects. If we do so, please follow up by searching that project's issue queue (both open and closed) for your problem and, if it doesn't exist, filing an issue with them.