Fixed up formatting for transforming.
This commit is contained in:
parent
5b18a63ebc
commit
1d282c544a
15
gulpfile.js
15
gulpfile.js
@ -72,6 +72,11 @@ function transformFile(path) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function padding(length) {
|
||||||
|
let pad = '';
|
||||||
|
while (pad.length < length) { pad += ' '; }
|
||||||
|
return pad;
|
||||||
|
}
|
||||||
function transform(path, options) {
|
function transform(path, options) {
|
||||||
var data = '';
|
var data = '';
|
||||||
|
|
||||||
@ -79,12 +84,16 @@ function transform(path, options) {
|
|||||||
data += chunk;
|
data += chunk;
|
||||||
}, function () {
|
}, function () {
|
||||||
var transformed = transformFile(path);
|
var transformed = transformFile(path);
|
||||||
|
var shortPath = path;
|
||||||
|
if (shortPath.substring(0, __dirname.length) == __dirname) {
|
||||||
|
shortPath = shortPath.substring(__dirname.length);
|
||||||
|
}
|
||||||
|
var size = fs.readFileSync(path).length;
|
||||||
if (transformed != null) {
|
if (transformed != null) {
|
||||||
console.log('Transformed:', path);
|
console.log('Transformed:', shortPath, padding(70 - shortPath.length), size, padding(6 - String(size).length), '=>', transformed.length);
|
||||||
data = transformed;
|
data = transformed;
|
||||||
} else {
|
} else {
|
||||||
var size = fs.readFileSync(path).length;
|
console.log('Preserved: ', shortPath, padding(70 - shortPath.length), size);
|
||||||
console.log('Preserved:', path, size);
|
|
||||||
}
|
}
|
||||||
this.queue(data);
|
this.queue(data);
|
||||||
this.queue(null);
|
this.queue(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user