-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (27 loc) · 873 Bytes
/
Copy pathindex.js
File metadata and controls
32 lines (27 loc) · 873 Bytes
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
// Generated by CoffeeScript 1.8.0
(function() {
var jade, replaceExt, through;
jade = require('react-jade');
through = require('through2');
replaceExt = require('replace-ext');
module.exports = function(opt) {
var stream;
stream = through.obj(function(file, enc, callback) {
var templateString;
if (file.isNull()) {
this.push(file);
return callback();
} else if (file.isBuffer()) {
templateString = jade.compileClient(file.contents.toString(), opt).toString();
file.contents = new Buffer('module.exports = ' + templateString);
file.path = replaceExt(file.path, '.js');
this.push(file);
return callback();
} else if (file.isStream()) {
throw new Error('Streams are not supported');
}
return callback();
});
return stream;
};
}).call(this);