-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
51 lines (41 loc) · 1.32 KB
/
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
42
43
44
45
46
47
48
49
50
51
'use strict';
var path = require('path');
var bourbon = require('node-bourbon');
var neat = require('node-neat');
var jade = require('jade');
var _ = require('lodash');
var basePath = __dirname;
var paths = {
assets: path.resolve(basePath, 'assets'),
images: path.resolve(basePath, 'assets', 'images'),
scripts: path.resolve(basePath, 'assets', 'js'),
styles: path.resolve(basePath, 'styles'),
templates: path.resolve(basePath, 'templates')
};
var RespokeStyle = (function RespokeStyle() {
var includeStylePaths = function includeStylePaths(myPaths, noBourbonPaths) {
var allPaths = myPaths || [];
if (!noBourbonPaths) {
allPaths = neat.with(paths);
}
allPaths.push(paths.styles);
return allPaths;
};
var renderSharedTemplate = function renderSharedTemplate(name, locals) {
var templatePath = path.join(paths.templates, name + '.jade');
var options = _.merge({}, locals, {
filename: templatePath
});
return jade.renderFile(templatePath, options);
};
return {
paths: paths,
bourbon: bourbon,
neat: neat,
includeStylePaths: includeStylePaths,
templateLocals: {
renderSharedTemplate: renderSharedTemplate
}
};
})();
module.exports = RespokeStyle;