gulp-polyfit
Generate the polyfill file by collecting the polyfill marks in the comment, thanks to https://polyfill.io
install
npm install gulp-polyfit --save-dev
usage
var gulp = var polyfit = gulp
test.js:
/** * polyfill: Array.from, * Number.parseInt, Number.isInteger */ { var args = Array // polyfill: Array.prototype.map, Array.prototype.filter return args}console // result is 6
run gulp polyfill
, and the polyfill_list.json will be:
the polyfill comment must start with "polyfill:"
and separate the features by commas
you can find all support features at https://polyfill.io/v2/docs/features/,
you can use (LABjs)['https://github.com/getify/LABjs']
or (yepnope.js)['https://github.com/SlexAxton/yepnope.js']
to load polyfills conditionally,