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

Commit

Permalink
Use uglify for concatenating, update CONTRIBUTING
Browse files Browse the repository at this point in the history
- Uglify for concatenating enables sourcemap support
- Add sourcemaps
- Fix `Candy.Core.log`: Shows now correct line numbers
  - we should test if it works in IE still (@pstadler likes to test?)
- Remove grunt-contrib-concat
- Update CONTRIBUTING.md with vagrant install
  - FIXME: Make this easier
  • Loading branch information
mweibel committed Jan 19, 2014
1 parent 9ed0f83 commit bfacd51
Show file tree
Hide file tree
Showing 10 changed files with 6,740 additions and 8,142 deletions.
19 changes: 16 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ You want to help us? **Awesome!**
### How to contribute
A few hopefully helpful hints to contributing to Candy

#### Using vagrant
1. [Fork](https://help.github.com/articles/fork-a-repo) Candy
2. [Install Vagrant](http://vagrantup.com/)
3. Follow instructions [for Candy Vagrant](https://github.com/candy-chat/vagrant)
4. Change the remote in the `candy` and `candy-plugins` repos: `git remote set-url origin git://github.com/YOURNAME/candy` (or candy-plugins)
5. Create a branch based on the `dev` branch (`git checkout -B my-awesome-feature`)
6. Run `grunt watch` to automatically run jshint (syntax checker) and the build of `candy.bundle.js` and `candy.min.js` while developing.
7. Make your changes, fix eventual *jshint* errors & push them back to your fork
8. Create a [pull request](https://help.github.com/articles/using-pull-requests)


#### On your own machine
Please note that you should have a working XMPP server to test your changes (the vagrant way does already have a working XMPP server).

1. [Fork](https://help.github.com/articles/fork-a-repo) Candy
2. Clone your fork
2. Checkout out `dev` branch (`git checkout dev`) & Update git submodules `git submodule update --init`
Expand All @@ -26,8 +40,7 @@ A few hopefully helpful hints to contributing to Candy
5. Install npm dependencies (`npm install` in candy root directory)
6. Create a branch based on the `dev` branch (`git checkout -B my-awesome-feature`)
7. Run `grunt watch` to automatically run jshint (syntax checker) and the build of `candy.bundle.js` and `candy.min.js` while developing.
8. Make your changes & push them back to your fork
9. Run `grunt jshint` and fix errors
10. Create a [pull request](https://help.github.com/articles/using-pull-requests)
8. Make your changes, fix eventual *jshint* errors & push them back to your fork
9. Create a [pull request](https://help.github.com/articles/using-pull-requests)

In case you have any questions, don't hesitate to ask on the [Mailing list](http://groups.google.com/group/candy-chat).
78 changes: 46 additions & 32 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,53 @@ module.exports = function(grunt) {
]
}
},
concat: {
bundle: {
src: [
'src/candy.js', 'src/core.js', 'src/view.js',
'src/util.js', 'src/core/action.js',
'src/core/chatRoom.js', 'src/core/chatRoster.js',
'src/core/chatUser.js', 'src/core/event.js',
'src/view/observer.js', 'src/view/pane.js',
'src/view/template.js', 'src/view/translation.js'
],
dest: 'candy.bundle.js'
},
libs: {
src: [
'libs/strophejs/strophe.js',
'libs/strophejs-plugins/muc/strophe.muc.js',
'libs/strophejs-plugins/disco/strophe.disco.js',
'libs/strophejs-plugins/caps/strophe.caps.jsonly.js',
'libs/mustache.js/mustache.js',
'libs/jquery-i18n/jquery.i18n.js',
'libs/dateformat/dateFormat.js'
],
dest: 'libs/libs.bundle.js'
}
},
uglify: {
bundle: {
files: {
'candy.bundle.js': [
'src/candy.js', 'src/core.js', 'src/view.js',
'src/util.js', 'src/core/action.js',
'src/core/chatRoom.js', 'src/core/chatRoster.js',
'src/core/chatUser.js', 'src/core/event.js',
'src/view/observer.js', 'src/view/pane.js',
'src/view/template.js', 'src/view/translation.js',
'src/view/translation/*.js'
]
},
options: {
sourceMap: true,
mangle: false,
compress: false,
beautify: true,
preserveComments: 'all'
}
},
min: {
files: {
'candy.min.js': ['candy.bundle.js']
}
},
libs: {
files: {
'libs/libs.bundle.js': [
'libs/strophejs/strophe.js',
'libs/strophejs-plugins/muc/strophe.muc.js',
'libs/strophejs-plugins/disco/strophe.disco.js',
'libs/strophejs-plugins/caps/strophe.caps.jsonly.js',
'libs/mustache.js/mustache.js',
'libs/jquery-i18n/jquery.i18n.js',
'libs/dateformat/dateFormat.js'
]
},
options: {
sourceMap: true,
mangle: false,
compress: false,
beautify: true,
preserveComments: 'all'
}
},
'libs-min': {
files: {
'libs/libs.min.js': ['libs/libs.bundle.js']
}
Expand All @@ -63,11 +78,11 @@ module.exports = function(grunt) {
watch: {
bundle: {
files: ['src/*.js', 'src/**/*.js'],
tasks: ['jshint', 'concat:bundle', 'uglify:bundle', 'notify:bundle']
tasks: ['jshint', 'uglify:bundle', 'uglify:min', 'notify:bundle']
},
libs: {
files: ['libs/*/**/*.js'],
tasks: ['concat:libs', 'uglify:libs', 'notify:libs']
tasks: ['uglify:libs', 'uglify:libs-min', 'notify:libs']
}
},
natural_docs: {
Expand All @@ -80,8 +95,8 @@ module.exports = function(grunt) {
}
},
clean: {
bundle: ['./candy.bundle.js', './candy.min.js'],
libs: ['./libs/libs.bundle.js', './libs/libs.min.js'],
bundle: ['./candy.bundle.js', './candy.bundle.map', './candy.min.js'],
libs: ['./libs/libs.bundle.js', './libs/libs.bundle.map', './libs/libs.min.js'],
docs: ['./docs']
},
mkdir: {
Expand Down Expand Up @@ -117,7 +132,6 @@ module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-natural-docs');
Expand All @@ -126,8 +140,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-sync-pkg');

grunt.registerTask('default', [
'jshint', 'concat:libs', 'uglify:libs',
'concat:bundle', 'uglify:bundle', 'notify:default'
'jshint', 'uglify:libs', 'uglify:libs-min',
'uglify:bundle', 'uglify:min', 'notify:default'
]);
grunt.registerTask('docs', ['mkdir:docs', 'natural_docs', 'notify:docs']);
};
Loading

0 comments on commit bfacd51

Please sign in to comment.