From 8c40bc551d3f2a355e1093629949d401d616fcfc Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng Date: Wed, 25 Nov 2020 15:04:47 +0100 Subject: [PATCH 1/2] Replace node-sass with sass (dart-sass) --- package.json | 4 ++-- src/sass.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f49fa36..0d5a48a 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "dependencies": { "autoprefixer": "^9.4.8", "cssnano": "^4.1.10", - "node-sass": "^4.11.0", - "postcss": "^7.0.14" + "postcss": "^7.0.14", + "sass": "^1.29.0" }, "devDependencies": { "chai": "^4.2.0", diff --git a/src/sass.js b/src/sass.js index aa9fe30..b6eb3ce 100644 --- a/src/sass.js +++ b/src/sass.js @@ -1,7 +1,6 @@ 'use strict' -const util = require('util') -const sass = require('node-sass') +const sass = require('sass') /** * Transform SASS to CSS. @@ -19,7 +18,7 @@ module.exports = async function(folderPath, str, opts) { // Dismiss sourceMap when output should be optimized const sourceMap = opts.optimize !== true - const result = await util.promisify(sass.render)({ + const result = sass.renderSync({ data: str, includePaths: [ folderPath ], sourceMap: sourceMap, From 85805ae1d50eaeb86069de1b4eb835c60924bec6 Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng Date: Wed, 25 Nov 2020 15:11:58 +0100 Subject: [PATCH 2/2] sass sourceMap options has to be either string or true with a outFile --- src/sass.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sass.js b/src/sass.js index b6eb3ce..751cd59 100644 --- a/src/sass.js +++ b/src/sass.js @@ -21,7 +21,7 @@ module.exports = async function(folderPath, str, opts) { const result = sass.renderSync({ data: str, includePaths: [ folderPath ], - sourceMap: sourceMap, + sourceMap: sourceMap ? '' : false, sourceMapEmbed: sourceMap, sourceMapContents: sourceMap })