Skip to content

Commit

Permalink
Add Babel
Browse files Browse the repository at this point in the history
This change set updates the applications build pipe line to include Babel.

This allows us to use the latest ES syntex and features (i.e. const/let,
arrow functions, etc) while still remaining compatible with older browsers
  • Loading branch information
Brad van der Laan committed Jun 17, 2018
1 parent 97b7aaf commit 390eb25
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ module.exports = function (grunt) {
}
},

babel: {
options: {
sourceMap: true,
presets: ['env']
},
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: ['scripts.js'],
dest: '.tmp/concat/scripts'
}],
},
},

// Make sure code styles are up to par and there are no obvious mistakes
eslint: {
options: {
Expand Down Expand Up @@ -352,6 +367,8 @@ module.exports = function (grunt) {
}
});

grunt.loadNpmTasks('grunt-babel');

grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
Expand Down Expand Up @@ -389,6 +406,7 @@ module.exports = function (grunt) {
'autoprefixer',
'concat',
'ngAnnotate',
'babel:dist',
'copy:dist',
'cssmin',
'uglify',
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@
"devDependencies": {
"angular-mocks": "~1.3.0",
"angular-scenario": "~1.3.0",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.7.0",
"connect-modrewrite": "^0.8.2",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.12.0",
"grunt": "^0.4.1",
"grunt-autoprefixer": "^3.0.3",
"grunt-babel": "^7.0.0",
"grunt-cli": "^0.1.13",
"grunt-concurrent": "^2.1.0",
"grunt-connect-proxy": "^0.2.0",
Expand Down

0 comments on commit 390eb25

Please sign in to comment.