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)'
» npm install gulp-sass
Videos
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)'
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.
import gulpSass from "gulp-sass";
import nodeSass from "node-sass";
const sass = gulpSass(nodeSass);
Try this. But I still don't know if this is the best.
- I know "node-sass" should be deprecated. Just an example. use "dart-sass" or "sass"
From sass github repository
import dartSass from 'sass';
import gulpSass from 'gulp-sass';
const sass = gulpSass( dartSass );
I had this problem and found that adding the standard sass npm npm install --save-dev sass and then adding the second section of the error message to my variable so that it looks like this const sass = require('gulp-sass')(require('sass')); worked.
If you, like me, use a modular system. Then this solution should help you!
You need to install SASS
It is also necessary that the gulp-sass be installed
import pkg from 'gulp';
const { src, dest, series, watch } = pkg;
import concat from 'gulp-concat'
import dartSass from 'sass'
import gulpSass from 'gulp-sass'
const sass = gulpSass(dartSass)
function scss() {
return src('app/scss/**/*.scss', { sourcemaps: true })
.pipe(sass.sync().on('error', sass.logError)) // scss to css
.pipe(concat('style.min.css'))
.pipe(dest(config.build.style, { sourcemaps: '../sourcemaps/' }))
}
async function builds() { scss() }
export { builds }
» npm install gulp-dart-sass