module.exports = function(grunt) {
	'use strict';

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),

		connect: {
			server: {
				options: {
					port: 8000,
					hostname: '*',
					base: 'www',
					keepalive: true,
					livereload: true
				}
			}
		},

		watch: {
			packagejson: {
				files: '<%= jshint.packagejson %>',
				tasks: ['jshint:packagejson', 'browserify:dist']
			},

			gruntfile: {
				files: '<%= jshint.gruntfile %>',
				tasks: ['jshint:gruntfile']
			},

			js: {
				files: '<%= jshint.dist %>',
				tasks: ['jshint:dist', 'browserify:dist']
			},

			css: {
				files: 'css/**/*.{less,css}',
				tasks: ['less']
			},

			html: {
				files: 'html/**/*.{swig,html}',
				tasks: ['swig']
			},

			livereload: {
				files: 'www/**/*',

				options: {
					livereload: true
				}
			}
		},

		browserify: {
			dist: {
				src: 'js/telepathy.js',
				dest: 'www/build/js/telepathy.js'
			}
		},

		jshint: {
			packagejson: 'package.json',
			gruntfile: 'Gruntfile.js',
			dist: 'js/**/*.{js,json}',

			options: {
				curly: false,
				eqeqeq: false,
				immed: true,
				latedef: true,
				newcap: true,
				noarg: true,
				sub: true,
				undef: true,
				boss: true,
				eqnull: true,
				smarttabs: true,
				strict: false,
				browser: true,
				node: true,

				globals: {
				}
			}
		},

		manifest: {
			dist: {
				src: [
					'v<%= pkg.version %>/css/*.css',
					'v<%= pkg.version %>/js/*.js',
					'v<%= pkg.version %>/img/*.png',
					'v<%= pkg.version %>/font/fontawesome*',
					'v<%= pkg.version %>/font/*.woff',
					'index.html'
				],

				dest: 'www/manifest.appcache',

				options: {
					basePath: 'www/',
					preferOnline: true,
					verbose: true,
					timestamp: true,

					exclude: [
						'v<%= pkg.version %>/img/icon-114x114.png',
						'v<%= pkg.version %>/img/startup-320x480.png',
						'v<%= pkg.version %>/img/startup-640x920.png',
						'v<%= pkg.version %>/img/startup-640x1096.png'
					]
				}
			}
		},

		less: {
			dist: {
				files: {
					'www/build/css/telepathy.css': 'css/telepathy.less'
				},

				options: {
					paths: ['css']
				}
			}
		},

		shell: {
			link: {
				command: 'rm www/v*-*; ln -s build www/v<%= pkg.version %>'
			}
		},

		swig: {
			index: {
				dest: 'www/',
				cwd: 'html/',
				src: 'index.html',

				version: '<%= pkg.version %>',

				init: {
					root: 'html/'
				}
			}
		}
	});

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-browserify');
	grunt.loadNpmTasks('grunt-manifest');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-shell');
	grunt.loadNpmTasks('grunt-swig');

	grunt.registerTask('default', ['test', 'build']);
	grunt.registerTask('test', ['jshint']);
	grunt.registerTask('build', ['browserify', 'less', 'shell:link', 'swig', 'manifest']);
};

@@ -366,39 +366,33 @@
 kagejson', '
-browserify:dist
+pkgreload
 '%5D%0A%09%09%09%7D,%0A%0A%09%09
@@ -722,16 +722,87 @@
 %0A%09%09%09%7D,%0A%0A
+%09%09%09ln: %7B%0A%09%09%09%09files: 'www/build/**/*',%0A%09%09%09%09tasks: %5B'shell:link'%5D%0A%09%09%09%7D,%0A%0A
 %09%09%09liver
@@ -817,24 +817,31 @@
 %0A%09%09%09%09files: 
+%5B%0A%09%09%09%09%09
 'www/**/*',%0A
@@ -839,16 +839,140 @@
 w/**/*',
+%0A%09%09%09%09%09'!www/build/**/*',%0A%09%09%09%09%09'!www/img/**/*',%0A%09%09%09%09%09'!www/font/**/*',%0A%09%09%09%09%09'!www/robots.txt',%0A%09%09%09%09%09'!www/sitemap.xml'%0A%09%09%09%09%5D,
 %0A%0A%09%09%09%09op
@@ -3102,12 +3102,197 @@
 fest'%5D);
+%0A%0A%09grunt.registerTask('pkgreload', 'Reload package.json', function() %7B%0A%09%09grunt.log.writeln('Reloading package.json');%0A%09%09grunt.config.data.pkg = grunt.file.readJSON('package.json');%0A%09%7D);
 %0A%7D;%0A

Update Gruntfile.js