-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
41 lines (32 loc) · 1020 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict'
const scss = require('jstransformer-scss')
exports.name = 'sass'
exports.outputFormat = 'css'
/**
* Clean the given options, injecting indentedSyntax if required.
*
* @param {array} options Array of options that will be passed to SASS.
*
* @returns {object} A cleaned up options array.
*/
function getOptions(options) {
// Ensure options exists.
options = options || {}
// Default indentedSyntax to true for SASS syntax.
if (!('indentedSyntax' in options)) {
options.indentedSyntax = true
}
return options
}
exports.render = function (str, options, locals) {
return scss.render(str, getOptions(options), locals)
}
exports.renderAsync = function (str, options, locals) {
return scss.renderAsync(str, getOptions(options), locals)
}
exports.renderFile = function (str, options, locals) {
return scss.renderFile(str, getOptions(options), locals)
}
exports.renderFileAsync = function (str, options, locals) {
return scss.renderFileAsync(str, getOptions(options), locals)
}