-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
55 lines (43 loc) · 1.52 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
52
53
54
55
var util = require('util');
var cssbase = require('borschik/lib/techs/css-base');
var ometajs = require('./css.ometajs.js');
var parser = ometajs.BorschikCSSParser;
var children = ometajs.BorschikCSSChildren;
var translator = ometajs.BorschikCSSTranslator;
function correctInherit(derived, base) {
util.inherits(derived, base);
// Copy all static methods and properties
Object.keys(base).forEach(function(key) {
if (!base.hasOwnProperty(key)) return;
derived[key] = base[key];
});
return derived;
}
exports.Tech = cssbase.Tech.inherit({
File: cssbase.File.inherit({
__constructor: function(tech, path, type, parent) {
var file = this;
this.__base(tech, path, type, parent);
function SpecificChildren(source) {
children.call(this, source);
this._file = file;
}
this._children = correctInherit(SpecificChildren, children);
},
parseInclude: function(content) {
return this._children.children(
this,
parser.parse(content))
},
processInclude: function(path) {
function SpecificTranslator(source) {
translator.call(this, source);
this._path = path;
}
return correctInherit(SpecificTranslator, translator).translate(path, this.content);
},
processPath: function(path) {
return path.replace(/^(.*?)(\?|$)/, '$1');
}
})
});