5

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 which requires a certain minimum version of Sass.

At the moment, if I want to find out what version of Sass is being used, I try to follow the trail like this, gulp-sass is a wrapper for node-sass which in its turn is providing Node bindings for libsass, which is a C compiler for Sass.

So to find out the version of Sass being used in my environment, I have to follow the chain and try to work out which version is used in each step and what version it then uses of the next step.

Surely there must be an easier way?

Mekap
  • 2,065
  • 14
  • 26
Ola Karlsson
  • 9,011
  • 7
  • 27
  • 37

4 Answers4

3

You may find out Sass version in Node-sass right from the terminal by the next line

node -e 'console.log(require("node-sass").info)'

Alexey Nikonov
  • 4,958
  • 5
  • 39
  • 66
  • Though four and a half years old, this is the answer that works if you install sass in a Docker Node Container. Node Sass has been deprecated for Dart Sass and the up to date command is `node -e 'console.log(require("sass").info)'`. Entering `sass --version` will return `sass: command not found`. – edwinbradford Jul 17 '23 at 10:44
2

We can agree that, from node-sass you can get the versions using :

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

console.log(sass.info);

From gulp-sass, you can send data which will be executed by node-sass. So something like this should do the trick :

var gulp = require('gulp');
var sass = require('gulp-sass'); 
console.log(sass.info);

It's going to be the .info() from node-sass who get's called in the end, giving you both it's version and libsass's version.

Mekap
  • 2,065
  • 14
  • 26
2

Look in your node_modules/grunt-sass/node_modules/node-sass/package.json

"libsass": "version"
romuleald
  • 1,406
  • 16
  • 31
0

At a cmd prompt, you can try node-sass -version

cmd: node-sass -version
node-sass       4.14.1  (Wrapper)       [JavaScript]
libsass         3.5.5   (Sass Compiler) [C/C++]
LReeder14
  • 608
  • 7
  • 10