Questions tagged [gulp-sass]

a gulp plugin for compilation of Sass to CSS.

gulp-sass is a gulp plugin for compilation of Sass files to CSS files.

Basic example of usage:

var gulp = require('gulp');
var sass = require('gulp-sass');

gulp.task('sass', function () {
  gulp.src('./sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./css'));
});

The plugin can also be used with gulp-sourcemaps:

var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('sass', function () { 
  gulp.src('./sass/*.scss')
    .pipe(sourcemaps.init())
    .pipe(sass())
    .pipe(sourcemaps.write('./sourcemaps'))
    .pipe(gulp.dest('./css'));
});

gulp-sass accepts node-sass compatible options, e.g.:

var gulp = require('gulp');
var sass = require('gulp-sass');

gulp.task('sass', function () {
  gulp.src('./sass/**/*.scss')
    .pipe(sass({ outputStyle: 'compressed' }))
    .pipe(gulp.dest('./css'));
});
749 questions
5
votes
1 answer

Gulp - SCSS Lint - Don't compile SCSS if linting fails

Just wondering if someone can help me with my Gulp setup. At the moment I am using gulp-sass and gulp-scss-lint with a watch task. What I want to happen is that when an scss file is saved for the linting task to run completely and if any errors or…
Tenatious
  • 849
  • 4
  • 12
  • 32
5
votes
1 answer

How to prevent gulp-sass to create folder "sass" after I gulp my scss file to css file?

var gulp = require('gulp'); var sass = require('gulp-sass'); gulp.task('sass', function() { gulp.src('src/**/*.scss') .pipe(sass()) .pipe(gulp.dest('./src/css')); }); gulp.task('watch', function() { gulp.watch('src/**/*.scss',…
qiuyuntao
  • 89
  • 5
5
votes
4 answers

How can I find out what version of Sass I'm using when running gulp-sass?

I just started using gulp-sass, is there a "easy" way to find out what version of Sass, that is being used? Not that I think it matters too much but I'm using gulp-sass in Visual Studio 2015 (CTP6). I need to know because I want to use a Sass mixin…
Ola Karlsson
  • 9,011
  • 7
  • 27
  • 37
5
votes
3 answers

Gulp Compass broke down after Sass update 3.4.6

When my gulp runs compass over my sass file I run into the following error: error src/scss/site/style.scss (/Library/Ruby/Gems/2.0.0/gems/sass-3.4.6/lib/sass/selector/abstract_sequence.rb:96:in `block in _specificity': undefined method `specificity'…
Dani
  • 2,448
  • 8
  • 27
  • 44
4
votes
2 answers

internal/modules/cjs/loader.js:750 return process.dlopen(module, path.toNamespacedPath(filename));

internal/modules/cjs/loader.js:750 return process.dlopen(module, path.toNamespacedPath(filename)); ^ Error: Your organization used Device Guard to block this app. Contact your support person for more…
Kirti Phuge
  • 41
  • 1
  • 2
4
votes
2 answers

Adding gulp-sass breaks by task runner

I have a basic gulp setup in VS2017 to minify my Javascript. I decided to add gulp-sass (my package.json says I'm on gulp-sass v4.0.1) but it throws this error: C:\Work\MyProject\MyProject\node_modules\gulp-sass\index.js:66 let sassMap; …
MSOACC
  • 3,074
  • 2
  • 29
  • 50
4
votes
0 answers

gulp-sass is very slow in gulp 4

After updating the gulp version to gulp 4, gulp-sass is taking much time to watch and compile scss. It was fast with gulp version 3.9.1. Gulp-sass version is 2.3.2. Is there any solution? Note: Removing the sourcemaps didn't help.
Fathima Linsa K
  • 618
  • 6
  • 14
4
votes
1 answer

SASS not compiling external Google Font with @import

I'm using the following line in scss: @import url(https://fonts.googleapis.com/css?family=Montserrat:300,700); Which gets compiled to css without errors to... exactly the same: @import…
kapoko
  • 938
  • 1
  • 11
  • 29
4
votes
1 answer

MSBuild LibSass Error

Compiling Sass files using gulp-sass to css locally with no problem. On build machine, node modules are installed and when compiling .net code, getting error: node_modules\node-sass\src\libsass\win\libsass.sln.metaproj:The specified solution…
user6401682
4
votes
3 answers

Export SCSS map to json format?

I am trying to find an easy way to export Sass maps to a json format so they can be used in my js as well. I have found multiple libraries around but they all are doing the opposite (from what I can tell) aka using js variables in sass. TL DR; Is…
NealVDV
  • 2,302
  • 3
  • 26
  • 51
4
votes
1 answer

Gulp SASS Sourcemap sources are incorrect

I am struggling to get my SASS sourcemaps to work correctly. The problem seems to be the "sources" attribute within the sourcemap and how my SASS files are nested. I have a Gulp task that compiles SASS to CSS. Here is an example of that var paths =…
4
votes
0 answers

gulp browsersync sass partials

I have the following problem and don't know whats going wrong with my gulpfile. Everything is working fine and my sass files are being compiled and the browser refreshed when changing something. But if I add a new partial file and import it into my…
4
votes
1 answer

node sass release 3.5.3 is breaking build

This is also currently biting my project, which uses gulp-sass. gulp-sass depends on node-sass#^3.4.1 which just automatically updated to 3.5.3 which is a breaking release. I have degraded my gulp sass version to the older(2.1.0) by updating the…
Sudipto Sarkar
  • 346
  • 2
  • 11
4
votes
1 answer

How to make Gulp wait until dest file is finished?

I want to run gulp-sass and after that check, what is the size of the generated css file. If I have the following in my gulpfile: gulp.task('sass', function () { gulp.src('src/scss/style.scss') .pipe(sass.sync().on('error', sass.logError)) …
Jaakko Karhu
  • 2,298
  • 4
  • 28
  • 41
4
votes
1 answer

Gulp watch not working with imported files but works with main file

So I have my build script below and everything is working perfectly except that if I save a file that is not my app.scss file but something that is imported into that file, the sass task does not run. So my gulp build is watching but not all the…