Skip to content

Commit

Permalink
add ES6 and babel support
Browse files Browse the repository at this point in the history
  • Loading branch information
llarousserie committed Dec 6, 2016
1 parent 8cca935 commit 7ff9ffe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 11 additions & 4 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = yeoman.extend({

constructor: function () {

var testLocal;
let testLocal;

yeoman.apply(this, arguments);

Expand Down Expand Up @@ -52,7 +52,7 @@ module.exports = yeoman.extend({
},

prompting: function () {
var done = this.async();
let done = this.async();

// Have Yeoman greet the user.
if (!this.options['skip-install-message']) {
Expand Down Expand Up @@ -156,7 +156,7 @@ module.exports = yeoman.extend({

this.prompt(prompts, function (answers) {

var features = answers.features;
let features = answers.features;

function hasFeature(feat) {
return features && features.indexOf(feat) !== -1;
Expand Down Expand Up @@ -195,7 +195,7 @@ module.exports = yeoman.extend({
}
);
this.fs.copy(
this.templatePath('gulp/tasks/!(styles).js'), //ignoring tasks/styles.js 'cause of templating'
this.templatePath('gulp/tasks/!(styles|scripts).js'), //ignoring tasks/styles.js and tasks/scripts.js 'cause of templating'
this.destinationPath('gulp/tasks/'),
{
ignore: 'gulp/tasks/styles.js'
Expand All @@ -212,6 +212,13 @@ module.exports = yeoman.extend({
testFramework: this.options['test-framework']
}
);
this.fs.copyTpl(
this.templatePath('gulp/tasks/scripts.js'),
this.destinationPath('gulp/tasks/scripts.js'),
{
useBabel: this.useBabel
}
);
this.fs.copy(
this.templatePath('_gulpfile.js'),
this.destinationPath('gulpfile.js')
Expand Down
4 changes: 4 additions & 0 deletions test/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ describe('babel', function () {
it('should contain a .babelrc file', function() {
assert.file('.babelrc');
})

it('should tasks/scripts.js contains babel', function() {
assert.fileContent('gulp/tasks/scripts.js', 'babel');
})
});

describe('off', function () {
Expand Down

0 comments on commit 7ff9ffe

Please sign in to comment.