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

Commit bfacd51

Browse files
committed
Use uglify for concatenating, update CONTRIBUTING
- 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
1 parent 9ed0f83 commit bfacd51

File tree

10 files changed

+6740
-8142
lines changed

10 files changed

+6740
-8142
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ You want to help us? **Awesome!**
1818
### How to contribute
1919
A few hopefully helpful hints to contributing to Candy
2020

21+
#### Using vagrant
22+
1. [Fork](https://help.github.com/articles/fork-a-repo) Candy
23+
2. [Install Vagrant](http://vagrantup.com/)
24+
3. Follow instructions [for Candy Vagrant](https://github.com/candy-chat/vagrant)
25+
4. Change the remote in the `candy` and `candy-plugins` repos: `git remote set-url origin git://github.com/YOURNAME/candy` (or candy-plugins)
26+
5. Create a branch based on the `dev` branch (`git checkout -B my-awesome-feature`)
27+
6. Run `grunt watch` to automatically run jshint (syntax checker) and the build of `candy.bundle.js` and `candy.min.js` while developing.
28+
7. Make your changes, fix eventual *jshint* errors & push them back to your fork
29+
8. Create a [pull request](https://help.github.com/articles/using-pull-requests)
30+
31+
32+
#### On your own machine
33+
Please note that you should have a working XMPP server to test your changes (the vagrant way does already have a working XMPP server).
34+
2135
1. [Fork](https://help.github.com/articles/fork-a-repo) Candy
2236
2. Clone your fork
2337
2. Checkout out `dev` branch (`git checkout dev`) & Update git submodules `git submodule update --init`
@@ -26,8 +40,7 @@ A few hopefully helpful hints to contributing to Candy
2640
5. Install npm dependencies (`npm install` in candy root directory)
2741
6. Create a branch based on the `dev` branch (`git checkout -B my-awesome-feature`)
2842
7. Run `grunt watch` to automatically run jshint (syntax checker) and the build of `candy.bundle.js` and `candy.min.js` while developing.
29-
8. Make your changes & push them back to your fork
30-
9. Run `grunt jshint` and fix errors
31-
10. Create a [pull request](https://help.github.com/articles/using-pull-requests)
43+
8. Make your changes, fix eventual *jshint* errors & push them back to your fork
44+
9. Create a [pull request](https://help.github.com/articles/using-pull-requests)
3245

3346
In case you have any questions, don't hesitate to ask on the [Mailing list](http://groups.google.com/group/candy-chat).

Gruntfile.js

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,53 @@ module.exports = function(grunt) {
2323
]
2424
}
2525
},
26-
concat: {
27-
bundle: {
28-
src: [
29-
'src/candy.js', 'src/core.js', 'src/view.js',
30-
'src/util.js', 'src/core/action.js',
31-
'src/core/chatRoom.js', 'src/core/chatRoster.js',
32-
'src/core/chatUser.js', 'src/core/event.js',
33-
'src/view/observer.js', 'src/view/pane.js',
34-
'src/view/template.js', 'src/view/translation.js'
35-
],
36-
dest: 'candy.bundle.js'
37-
},
38-
libs: {
39-
src: [
40-
'libs/strophejs/strophe.js',
41-
'libs/strophejs-plugins/muc/strophe.muc.js',
42-
'libs/strophejs-plugins/disco/strophe.disco.js',
43-
'libs/strophejs-plugins/caps/strophe.caps.jsonly.js',
44-
'libs/mustache.js/mustache.js',
45-
'libs/jquery-i18n/jquery.i18n.js',
46-
'libs/dateformat/dateFormat.js'
47-
],
48-
dest: 'libs/libs.bundle.js'
49-
}
50-
},
5126
uglify: {
5227
bundle: {
28+
files: {
29+
'candy.bundle.js': [
30+
'src/candy.js', 'src/core.js', 'src/view.js',
31+
'src/util.js', 'src/core/action.js',
32+
'src/core/chatRoom.js', 'src/core/chatRoster.js',
33+
'src/core/chatUser.js', 'src/core/event.js',
34+
'src/view/observer.js', 'src/view/pane.js',
35+
'src/view/template.js', 'src/view/translation.js',
36+
'src/view/translation/*.js'
37+
]
38+
},
39+
options: {
40+
sourceMap: true,
41+
mangle: false,
42+
compress: false,
43+
beautify: true,
44+
preserveComments: 'all'
45+
}
46+
},
47+
min: {
5348
files: {
5449
'candy.min.js': ['candy.bundle.js']
5550
}
5651
},
5752
libs: {
53+
files: {
54+
'libs/libs.bundle.js': [
55+
'libs/strophejs/strophe.js',
56+
'libs/strophejs-plugins/muc/strophe.muc.js',
57+
'libs/strophejs-plugins/disco/strophe.disco.js',
58+
'libs/strophejs-plugins/caps/strophe.caps.jsonly.js',
59+
'libs/mustache.js/mustache.js',
60+
'libs/jquery-i18n/jquery.i18n.js',
61+
'libs/dateformat/dateFormat.js'
62+
]
63+
},
64+
options: {
65+
sourceMap: true,
66+
mangle: false,
67+
compress: false,
68+
beautify: true,
69+
preserveComments: 'all'
70+
}
71+
},
72+
'libs-min': {
5873
files: {
5974
'libs/libs.min.js': ['libs/libs.bundle.js']
6075
}
@@ -63,11 +78,11 @@ module.exports = function(grunt) {
6378
watch: {
6479
bundle: {
6580
files: ['src/*.js', 'src/**/*.js'],
66-
tasks: ['jshint', 'concat:bundle', 'uglify:bundle', 'notify:bundle']
81+
tasks: ['jshint', 'uglify:bundle', 'uglify:min', 'notify:bundle']
6782
},
6883
libs: {
6984
files: ['libs/*/**/*.js'],
70-
tasks: ['concat:libs', 'uglify:libs', 'notify:libs']
85+
tasks: ['uglify:libs', 'uglify:libs-min', 'notify:libs']
7186
}
7287
},
7388
natural_docs: {
@@ -80,8 +95,8 @@ module.exports = function(grunt) {
8095
}
8196
},
8297
clean: {
83-
bundle: ['./candy.bundle.js', './candy.min.js'],
84-
libs: ['./libs/libs.bundle.js', './libs/libs.min.js'],
98+
bundle: ['./candy.bundle.js', './candy.bundle.map', './candy.min.js'],
99+
libs: ['./libs/libs.bundle.js', './libs/libs.bundle.map', './libs/libs.min.js'],
85100
docs: ['./docs']
86101
},
87102
mkdir: {
@@ -117,7 +132,6 @@ module.exports = function(grunt) {
117132

118133
grunt.loadNpmTasks('grunt-contrib-jshint');
119134
grunt.loadNpmTasks('grunt-contrib-uglify');
120-
grunt.loadNpmTasks('grunt-contrib-concat');
121135
grunt.loadNpmTasks('grunt-contrib-watch');
122136
grunt.loadNpmTasks('grunt-contrib-clean');
123137
grunt.loadNpmTasks('grunt-natural-docs');
@@ -126,8 +140,8 @@ module.exports = function(grunt) {
126140
grunt.loadNpmTasks('grunt-sync-pkg');
127141

128142
grunt.registerTask('default', [
129-
'jshint', 'concat:libs', 'uglify:libs',
130-
'concat:bundle', 'uglify:bundle', 'notify:default'
143+
'jshint', 'uglify:libs', 'uglify:libs-min',
144+
'uglify:bundle', 'uglify:min', 'notify:default'
131145
]);
132146
grunt.registerTask('docs', ['mkdir:docs', 'natural_docs', 'notify:docs']);
133147
};

0 commit comments

Comments
 (0)