mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
feat(): add polyfill task
* feat(): polyfills task * fix(): remove base option * fix(): minification and small polyfills * fix(): add readme and new file names * fix(): change task names * fix(): naming changes
This commit is contained in:

committed by
Brandy Carney

parent
f477aa2391
commit
ce78194207
@ -74,6 +74,7 @@
|
|||||||
"gulp-strip-debug": "^1.1.0",
|
"gulp-strip-debug": "^1.1.0",
|
||||||
"gulp-tslint": "^5.0.0",
|
"gulp-tslint": "^5.0.0",
|
||||||
"gulp-typescript": "^2.13.6",
|
"gulp-typescript": "^2.13.6",
|
||||||
|
"gulp-uglify": "^2.0.0",
|
||||||
"gulp-util": "^3.0.6",
|
"gulp-util": "^3.0.6",
|
||||||
"gulp-watch": "^4.2.4",
|
"gulp-watch": "^4.2.4",
|
||||||
"html-entities": "^1.1.3",
|
"html-entities": "^1.1.3",
|
||||||
@ -104,6 +105,7 @@
|
|||||||
"tslint": "^3.15.1",
|
"tslint": "^3.15.1",
|
||||||
"tslint-ionic-rules": "0.0.5",
|
"tslint-ionic-rules": "0.0.5",
|
||||||
"typescript": "2.0.2",
|
"typescript": "2.0.2",
|
||||||
|
"uglify": "^0.1.5",
|
||||||
"vinyl": "^1.2.0",
|
"vinyl": "^1.2.0",
|
||||||
"webpack": "^2.1.0-beta.20",
|
"webpack": "^2.1.0-beta.20",
|
||||||
"webpack-dev-server": "^1.14.1",
|
"webpack-dev-server": "^1.14.1",
|
||||||
|
@ -6,4 +6,5 @@ import './tasks/lint';
|
|||||||
import './tasks/release';
|
import './tasks/release';
|
||||||
import './tasks/snapshot';
|
import './tasks/snapshot';
|
||||||
import './tasks/test';
|
import './tasks/test';
|
||||||
|
import './tasks/polyfills';
|
||||||
//import './tasks/theme';
|
//import './tasks/theme';
|
||||||
|
55
scripts/gulp/tasks/polyfills.ts
Normal file
55
scripts/gulp/tasks/polyfills.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import { task, src, dest } from 'gulp';
|
||||||
|
const concat = require('gulp-concat');
|
||||||
|
const uglify = require('gulp-uglify');
|
||||||
|
|
||||||
|
task('polyfill', ['polyfill.modern', 'polyfill.all', 'polyfill.ng', 'polyfill.copy-readme']);
|
||||||
|
|
||||||
|
task('polyfill.modern', (done) => {
|
||||||
|
return src([
|
||||||
|
'node_modules/zone.js/dist/zone.min.js',
|
||||||
|
'node_modules/zone.js/dist/proxy.min.js',
|
||||||
|
'node_modules/core-js/es6/array.js',
|
||||||
|
'node_modules/core-js/es6/date.js',
|
||||||
|
'node_modules/core-js/es6/function.js',
|
||||||
|
'node_modules/core-js/es6/map.js',
|
||||||
|
'node_modules/core-js/es6/number.js',
|
||||||
|
'node_modules/core-js/es6/object.js',
|
||||||
|
'node_modules/core-js/es6/parse-float.js',
|
||||||
|
'node_modules/core-js/es6/parse-int.js',
|
||||||
|
'node_modules/core-js/es6/promise.js',
|
||||||
|
'node_modules/core-js/es6/set.js',
|
||||||
|
'node_modules/core-js/es6/string.js',
|
||||||
|
'node_modules/core-js/es7/reflect.js'
|
||||||
|
])
|
||||||
|
.pipe(concat('polyfills.modern.js'))
|
||||||
|
.pipe(uglify())
|
||||||
|
.pipe(dest('dist/ionic-angular/polyfills/'), done);
|
||||||
|
});
|
||||||
|
|
||||||
|
task('polyfill.all', (done) => {
|
||||||
|
return src([
|
||||||
|
'node_modules/zone.js/dist/zone.min.js',
|
||||||
|
'node_modules/zone.js/dist/proxy.min.js',
|
||||||
|
'node_modules/core-js/es6/index.js',
|
||||||
|
'node_modules/core-js/es7/reflect.js'
|
||||||
|
])
|
||||||
|
.pipe(concat('polyfills.js'))
|
||||||
|
.pipe(uglify())
|
||||||
|
.pipe(dest('dist/ionic-angular/polyfills/'), done);
|
||||||
|
});
|
||||||
|
|
||||||
|
task('polyfill.ng', (done) => {
|
||||||
|
return src([
|
||||||
|
'node_modules/zone.js/dist/zone.min.js',
|
||||||
|
'node_modules/zone.js/dist/proxy.min.js',
|
||||||
|
'node_modules/core-js/es7/reflect.js'
|
||||||
|
])
|
||||||
|
.pipe(concat('polyfills.ng.js'))
|
||||||
|
.pipe(uglify())
|
||||||
|
.pipe(dest('dist/ionic-angular/polyfills/'), done);
|
||||||
|
});
|
||||||
|
|
||||||
|
task('polyfill.copy-readme', (done) => {
|
||||||
|
return src('scripts/npm/polyfills.readme.md')
|
||||||
|
.pipe(dest('dist/ionic-angular/polyfills/README.md'), done);
|
||||||
|
});
|
46
scripts/npm/polyfills.readme.md
Normal file
46
scripts/npm/polyfills.readme.md
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
## polyfills.js
|
||||||
|
Contains all polyfills needed to work on the largest range of devices. This is the default polyfill.
|
||||||
|
|
||||||
|
##### Targets:
|
||||||
|
- Android 4.4.2 and above
|
||||||
|
- iOS back to iOS 8
|
||||||
|
|
||||||
|
##### Includes:
|
||||||
|
- All ES6 features
|
||||||
|
- zone.js
|
||||||
|
- ES7 reflection
|
||||||
|
|
||||||
|
|
||||||
|
## polyfills.modern.js
|
||||||
|
A limited of set of polyfills to work on more modern browsers. This file limits the number of ES6 polyfills which are already natively included in modern browsers.
|
||||||
|
|
||||||
|
##### Targets:
|
||||||
|
- Android 5.0 and above
|
||||||
|
- iOS 9 and above
|
||||||
|
|
||||||
|
##### Includes:
|
||||||
|
- zone.js
|
||||||
|
- ES7 reflection,
|
||||||
|
- ES6 polyfills, except for:
|
||||||
|
new regexp features,
|
||||||
|
math features,
|
||||||
|
symbols,
|
||||||
|
typed arrays,
|
||||||
|
weak maps / weak sets
|
||||||
|
|
||||||
|
|
||||||
|
## polyfills.ng.js
|
||||||
|
Only the required polyfill for Angular 2. This does not come with any ES6 polyfills. Note that all polyfill files listed here included the required polyfills for Angular 2 to work correctly.
|
||||||
|
|
||||||
|
##### Targets:
|
||||||
|
- Android 5.0 and above
|
||||||
|
- iOS 10 and above
|
||||||
|
|
||||||
|
##### Includes:
|
||||||
|
- zone.js
|
||||||
|
- ES7 reflection
|
||||||
|
|
||||||
|
|
||||||
|
## ECMAScript 6 Compatibility
|
||||||
|
|
||||||
|
To easily judge which polyfill you may need you can check this [ES6 support table](https://kangax.github.io/compat-table/es6/).
|
Reference in New Issue
Block a user