forked from sprity/sprity-sass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (33 loc) · 986 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
'use strict';
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs-extra'));
var path = require('path');
var getTemplate = function (opt) {
return fs.readFileAsync(path.join(__dirname, 'template', 'scss.hbs'), 'utf8');
};
var transform = Promise.method(function (layouts, source, opt, Handlebars) {
var template = Handlebars.compile(source);
var classIndicator = '.'; // opt['style-indicator'] ? opt['style-indicator'] : '.';
return template({
layouts: layouts,
opt: opt,
indicator: classIndicator
});
});
module.exports = {
process: function (layouts, opt, Handlebars) {
Handlebars.registerHelper('divide', function (dividend, divisor) {
return dividend / divisor;
});
return getTemplate(opt)
.then(function (source) {
return transform(layouts, source, opt, Handlebars);
});
},
isBeautifyable: function (opt) {
return false;
},
extension: function (opt) {
return 'scss';
}
};