Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I tell which version of Sass is running with node-sass? #961

Closed
markweston opened this issue May 15, 2015 · 7 comments
Closed

How can I tell which version of Sass is running with node-sass? #961

markweston opened this issue May 15, 2015 · 7 comments

Comments

@markweston
Copy link

Hi,

This might sound like an odd question but I'm using gulp-sass, a wrapper for node-sass which in turn uses libsass.

I'm confused as to how I know which version of Sass I'm running. Does it simply correspond to the version of node-sass? I found this more self explanatory when using Ruby gems for sass.

Thanks.

@am11
Copy link
Contributor

am11 commented May 15, 2015

Hi,

node-sass is a wrapper around libsass which is an alternate / substitute implementation of Sass language compiler written in C/C++, as opposed to the primary implementation in Ruby language.

Going by sass/libsass#629, we can say LibSass' latest version (v3.2.4) fully conforms with Sass language v3.3 and majority of v3.4 features. In other words, the lines are blur from that perspective. Besides, (IMO) the language version is an implementation detail. However, from node-sass' consumer perspective, the more imperative and distinguishing detail is the LibSass version itself, which node sass emits as follow.

From CLI:

node-sass -v
# or, depending on cwd and env PATH status, you may need:
#
# node_modules/.bin/node-sass -v

# OR even

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

# OR -p (processes && evaluates)

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

From code usage:

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

With latest node-sass, the output is:

node-sass       3.1.1   (Wrapper)       [JavaScript]
libsass         3.2.4   (Sass Compiler) [C/C++]

Let us know if and how we can further improve this experience.

@xzyfer
Copy link
Contributor

xzyfer commented May 16, 2015

@markweston also see my response #962 (comment)

@xzyfer xzyfer closed this as completed May 16, 2015
@ggamir
Copy link

ggamir commented Dec 16, 2017

Another way to check the version of an indirect-dependency (node-sass) used in your direct dependency (gulp-sass) is to follow the trail of downloaded dependency files until you get to node-sass folder and check its package.json to see what version of libsass it depends on.

On CLI within your project directory where your node_modules may be (if you're using npm for dependencies):

cat node_modules/gulp-sass/node_modules/node-sass/package.json | grep libsass

My current project outputs:

"libsass": "3.1.0-beta",
  "description": "Wrapper around libsass",
    "libsass",

@bivainis
Copy link

In case your node-sass (or any other module) is in node_modules dir, instead of this line:
# node_modules/.bin/node-sass -v
you could simply use npx
npx node-sass -v

@MusawwerRasheed
Copy link

MusawwerRasheed commented Mar 26, 2019

npm node-sass -v works well

@fazil-imraan
Copy link

npm node-sass -v works well

It only shows the npm version not the node-sass version i checked

@nerdess
Copy link

nerdess commented May 25, 2021

I found this command:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants