Skip to content

Commit

Permalink
feat(): add polyfill task
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jgw96 authored and brandyscarney committed Sep 13, 2016
1 parent f477aa2 commit ce78194
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"gulp-strip-debug": "^1.1.0",
"gulp-tslint": "^5.0.0",
"gulp-typescript": "^2.13.6",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.6",
"gulp-watch": "^4.2.4",
"html-entities": "^1.1.3",
Expand Down Expand Up @@ -104,6 +105,7 @@
"tslint": "^3.15.1",
"tslint-ionic-rules": "0.0.5",
"typescript": "2.0.2",
"uglify": "^0.1.5",
"vinyl": "^1.2.0",
"webpack": "^2.1.0-beta.20",
"webpack-dev-server": "^1.14.1",
Expand Down
1 change: 1 addition & 0 deletions scripts/gulp/gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import './tasks/lint';
import './tasks/release';
import './tasks/snapshot';
import './tasks/test';
import './tasks/polyfills';
//import './tasks/theme';
55 changes: 55 additions & 0 deletions scripts/gulp/tasks/polyfills.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 46 additions & 0 deletions scripts/npm/polyfills.readme.md
Original file line number Diff line number Diff line change
@@ -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/).

0 comments on commit ce78194

Please sign in to comment.