Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

chore(babel): added babel to support es6 #10517

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion gulp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ module.exports = {
cssIEPaths : ['src/**/ie_fixes.css'],
paths: 'src/+(components|core)/**',
outputDir: 'dist/',
demoFolder: 'demo-partials'
demoFolder: 'demo-partials',
browsers: [
'last 2 versions',
'not ie <= 10',
'not ie_mob <= 10',
'last 4 Android versions',
'Safari >= 8'
]
};


4 changes: 4 additions & 0 deletions gulp/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var ngAnnotate = require('gulp-ng-annotate');
var insert = require('gulp-insert');
var gulpif = require('gulp-if');
var nano = require('gulp-cssnano');
var babel = require('gulp-babel');
var postcss = require('postcss');
var _ = require('lodash');
var constants = require('./const');
Expand Down Expand Up @@ -48,6 +49,9 @@ function buildJs () {

var jsBuildStream = gulp.src( jsFiles )
.pipe(filterNonCodeFiles())
.pipe(babel({
presets: [["env", {targets: {browsers: config.browsers}}]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think uglify: true should be added here. Readme and PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like useBuiltIns would work better

Copy link
Contributor

@Frank3K Frank3K Mar 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand it correctly useBuiltIns alone won't solve the minification issues. I'm not sure what uglify + useBuiltIns does.

The option useBuiltInsseems to require a module loader (see explanation).

}))
.pipe(utils.buildNgMaterialDefinition())
.pipe(plumber())
.pipe(ngAnnotate())
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"angular-sanitize": "^1.5.0",
"angular-touch": "^1.5.0",
"angularytics": "^0.4.0",
"babel-preset-env": "^1.2.2",
"canonical-path": "0.0.2",
"cli-color": "^1.0.0",
"colors": "^1.1.0",
Expand All @@ -41,6 +42,7 @@
"gulp": "^3.9.1",
"gulp-add-src": "^0.2.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-babel": "^6.1.2",
"gulp-concat": "^2.2.0",
"gulp-connect": "^4.1.0",
"gulp-cssnano": "^2.1.2",
Expand Down
13 changes: 3 additions & 10 deletions scripts/gulp-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ var fs = require('fs');
var path = require('path');
var findModule = require('../config/ngModuleData.js');

const {browsers} = require('../gulp/config');

exports.humanizeCamelCase = function(str) {
switch (str) {
case 'fabSpeedDial':
Expand Down Expand Up @@ -311,13 +313,4 @@ exports.cssToNgConstant = function(ngModule, factoryName) {
});
};

exports.autoprefix = function() {

return autoprefixer({browsers: [
'last 2 versions',
'not ie <= 10',
'not ie_mob <= 10',
'last 4 Android versions',
'Safari >= 8'
]});
};
exports.autoprefix = () => autoprefixer({browsers});