chickendinosaur-footprint
v0.1.8
Published
Consolidates redundant code to reduce file size footprint based on the selected transform.
Downloads
12
Maintainers
Readme
Working with ES6, Babel/Babelify, Browserify? This is for you!
- Node module for reorganizing redundant code. Each Transform is just a method that takes in a text string and can be used by itself.
- Wrote this so I can be at peace migrating to ES6 early and using Browserify and because being bloated bugs me cough jQuery.
- Minimizes the footprint on Babel concatinated files like a Browserify bundle.
- Works on minified (minified with uglify) and non-minified code against any style formatting! (the output is kept in original form for debuggin purposes so even though it will rip against uglified code, you will need to re-uglify after which uglifying should always be done last in the build process anyway)
- nodejs
- npm install -g gulp
- npm install
gulp test
npm install chickendinosaur-footprint
- footprint.Transform.usestrict
- footprint.Transform.babel (uses footprint.Transform.usestrict)
var footprint = require('chickendinosaur-footprint');
footprint.Transformer({
debug:true
})
.src('./test/mock/babelMock.dirty.js')
.transform(footprint.Transform.babel)
.dest('./dist/babelMock.transformed.js');
var footprint = require('chickendinosaur-footprint');
var fs = require('fs');
var text = fs.readFileSync('./test/mock/babelMock.dirty.js', 'utf-8');
var output = footprint.Transform.babel(text);
var footprint = require('chickendinosaur-footprint');
footprint.Transformer({
debug:true
})
.src('./test/mock/babelMock.dirty.js')
.transform(footprint.Transform.babel)
.transform(footprint.Transform.usestrict)
.dest('./dist/babelMock.transformed.js')
var footprint = require('chickendinosaur-footprint');
footprint.Transformer({
debug:true
})
.src('./test/mock/usestrictMock.dirty.js')
.transform(footprint.Transform.usestrict)
.dest('./dist/usestrictMock.transformed.js')
.src('./test/mock/babelMock.dirty.js')
.transform(footprint.Transform.babel)
.dest('./dist/babelMock.transformed.js');
var footprint = require('chickendinosaur-footprint');
gulp.task('footprint', function() {
footprint.Transformer({
debug:true
})
.src('./test/mock/usestrictMock.dirty.js')
.transform(footprint.Transform.usestrict)
.dest('./dist/usestrictMock.transformed.js');
});
'use strict' "use strict" 'use strict'; "use strict";
"use strict";
Input:
- ./test/mock/usestrictMock.dirty.js
- 0.0560 KB
Transform:
- usestrict
Difference:
- 0.0430 KB
- 76.7857 %
Output:
- ./dist/usestrictMock.transformed.js
- 0.0130 KB
- Added consolidatoin for require/_interopRequireDefault statements.
- Changed all output to original form instead of uglified version since you will have to uglify after anyway.