'use strict'

const sass = require('sass')

/**
 * Transform SASS to CSS.
 * @public
 * @param {String} folderPath - Path to the folder containing the SASS file.
 * @param {String} str - SASS.
 * @param {Object} opts - Optional options for the task.
 * @returns {Promise<String>} CSS.
 */
module.exports = async function(folderPath, str, opts) {

	// SASS can't handle empty files
	if (str === '') return str

	// Dismiss sourceMap when output should be optimized
	const sourceMap = opts.optimize !== true

	const result = sass.renderSync({
		data: str,
		includePaths: [ folderPath ],
		sourceMap: sourceMap === true ? '' : false,
		sourceMapEmbed: sourceMap,
		sourceMapContents: sourceMap
	})

	return result.css.toString()

}
@@ -7,16 +7,45 @@
 trict'%0A%0A
+const util = require('util')%0A
 const sa
@@ -545,16 +545,37 @@
 esult = 
+await util.promisify(
 sass.ren
@@ -581,12 +581,9 @@
 nder
-Sync
+)
 (%7B%0A%09

Switch to async version