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

4

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?

Dependence answered 22/4, 2015 at 9:48 Comment(0)
L
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)'

Logical answered 29/1, 2019 at 21:46 Comment(1)
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.Barney
R
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.

Ramify answered 22/4, 2015 at 10:0 Comment(1)
I had to use console.log(sass.compiler.info);Shay
E
2

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

"libsass": "version"
Erdda answered 23/4, 2015 at 13:8 Comment(0)
P
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++]
Pons answered 19/10, 2021 at 15:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.