Skip to content

Commit

Permalink
Merge pull request #18 from fudanchii/optimize
Browse files Browse the repository at this point in the history
Some Gruntfile fixes
  • Loading branch information
addyosmani committed Aug 4, 2013
2 parents 64ed1bb + 69a6a8e commit c1385ff
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ See the [contributing docs](https://github.com/yeoman/yeoman/blob/master/contrib

## License

[BSD license](http://opensource.org/licenses/bsd-license.php)
[MIT license](http://opensource.org/licenses/mit-license.php)
1 change: 1 addition & 0 deletions templates/app/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require.config({
paths: {
eventemitter: 'bower_components/eventemitter2/lib/eventemitter2',
aura: 'bower_components/aura/lib',
jquery: 'bower_components/jquery/jquery',
underscore: 'bower_components/underscore/underscore'
Expand Down
9 changes: 5 additions & 4 deletions templates/aura_components/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
define(['underscore'], function (_) {
'use strict';

return {

initialize: function () {
this.$el.on('click', this.someCoolFeature.bind(this));
this.$el.on('click', _.bind(this.someCoolFeature, this));
this.render();
},

Expand All @@ -12,13 +13,13 @@ define(['underscore'], function (_) {
this.$el.html('Click me: ' + this.$el.html());
},

someCoolFeature: function(){
someCoolFeature: function () {
//Awesome code
var element = this.$el;
element.fadeOut(200, function(){
element.fadeOut(200, function () {
element.fadeIn(200);
});
}
};

});
});
22 changes: 11 additions & 11 deletions templates/common/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ module.exports = function (grunt) {
requirejs: {
compile: {
options: {
baseUrl: '.',
optimize: 'none',
baseUrl: '<%= yeoman.app %>',
paths: {
aura: 'app/bower_components/aura/lib',
aura: 'bower_components/aura/lib',
jquery: 'empty:',
underscore: 'empty:',
eventemitter: 'app/bower_components/eventemitter2/lib/eventemitter2'
eventemitter: 'bower_components/eventemitter2/lib/eventemitter2'
},
shim: {
underscore: {
exports: '_'
}
},
include: [
'app/main'
modules: [
{name: 'main'}
],
exclude: ['jquery', 'aura/aura'],
out: '<%= yeoman.dist %>/main.js'
dir: '<%= yeoman.dist %>',
fileExclusionRegExp: /^(tests?|spec|Gruntfile\.js)$/,
removeCombined: true
}
}
},
Expand Down Expand Up @@ -92,8 +92,8 @@ module.exports = function (grunt) {
},
files: {
src: [
'app/aura_components/**.js',
'app/extensions/**.js',
'app/aura_components/**/*.js',
'app/extensions/*.js',
'app/main.js',
]
}
Expand Down Expand Up @@ -155,6 +155,6 @@ module.exports = function (grunt) {
// watch-spec allows us to use the spec task within a watch without having
// connect try to launch a server on each cycle (which throws a Fatal error);
grunt.registerTask('watch-spec', ['jshint', 'mocha']);
grunt.registerTask('build', ['clean', 'compass', 'spec', 'copy', 'requirejs']);
grunt.registerTask('build', ['clean', 'compass', 'spec', 'requirejs']);
grunt.registerTask('default', ['compass', 'spec', 'watch']);
};
6 changes: 4 additions & 2 deletions templates/extensions/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
define(['underscore'], function (_) {
define(function () {
'use strict';

return {
name: '<%= _.slugify(name) %>',
initialize: function (application) {
// Your brilliant code here!
application.logger.log('Initializing extension: <%= _.slugify(name) %>');
}
};

});
});

0 comments on commit c1385ff

Please sign in to comment.