1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | var es = require('event-stream'),
|
11 | espowerSourceToSource = require('espower-source');
|
12 |
|
13 | module.exports = function (opt) {
|
14 | 'use strict';
|
15 |
|
16 | function instrument(file, cb) {
|
17 | if (file.isNull()) {
|
18 | cb(null, file);
|
19 | } else if (file.isStream()) {
|
20 | cb(new Error('gulp-espower: Streaming not supported'));
|
21 | } else {
|
22 | file.contents = new Buffer(espowerSourceToSource(file.contents.toString('utf8'), file.path, opt));
|
23 | cb(null, file);
|
24 | }
|
25 | }
|
26 |
|
27 | return es.map(instrument);
|
28 | };
|