Skip to content

Commit

Permalink
feat(app): additional app generator option for ES6 preprocessing usin…
Browse files Browse the repository at this point in the history
…g babel

    Building on from the ES6 client preprocessor have added karma config and related
    karma-babel-preprocessor module for ES6 client tests for complete ES6 client support

    Related issue: Any plans for es6 and traceur support? #684
  • Loading branch information
Carson Bruce authored and Awk34 committed Jun 17, 2015
1 parent 7a3b6d4 commit cbb06a4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"grunt-contrib-coffee": "^0.10.1",<% } %><% if(filters.jade) { %>
"grunt-contrib-jade": "^0.11.0",<% } %><% if(filters.less) { %>
"grunt-contrib-less": "^0.11.0",<% } %><% if(filters.babel) { %>
"karma-babel-preprocessor": "^5.2.1",
"grunt-babel": "~5.0.0",<% } %>
"grunt-google-cdn": "~0.4.0",
"grunt-newer": "~0.7.0",
Expand Down
17 changes: 16 additions & 1 deletion app/templates/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module.exports = function(config) {

preprocessors: {
'**/*.jade': 'ng-jade2js',
'**/*.html': 'html2js',
'**/*.html': 'html2js',<% if(filters.babel) { %>
'client/app/**/*.js': 'babel',<% } %>
'**/*.coffee': 'coffee',
},

Expand All @@ -48,6 +49,20 @@ module.exports = function(config) {
stripPrefix: 'client/'
},
<% if(filters.babel) { %>
babelPreprocessor: {
options: {
sourceMap: 'inline'
},
filename: function (file) {
return file.originalPath.replace(/\.js$/, '.es5.js');
},
sourceFileName: function (file) {
return file.originalPath;
}
},
<% } %>
// list of files / patterns to exclude
exclude: [],
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"angular": ">=1.2.*",
"json3": "~3.3.1",
"es5-shim": "~3.0.1",
"jquery": "~1.11.0",
"bootstrap-sass-official": "~3.1.1",
"bootstrap": "~3.1.1",
"angular-resource": ">=1.2.*",
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"main": "server/app.js",
"dependencies": {
"express": "~4.0.0",
"express": "~4.9.0",
"morgan": "~1.0.0",
"body-parser": "~1.5.0",
"method-override": "~1.0.0",
Expand Down Expand Up @@ -46,6 +46,8 @@
"grunt-contrib-coffee": "^0.10.1",
"grunt-contrib-jade": "^0.11.0",
"grunt-contrib-less": "^0.11.0",
"karma-babel-preprocessor": "^5.2.1",
"grunt-babel": "~5.0.0",
"grunt-google-cdn": "~0.4.0",
"grunt-newer": "~0.7.0",
"grunt-ng-annotate": "^0.2.3",
Expand Down

0 comments on commit cbb06a4

Please sign in to comment.