Install Syntastic Vim Syntax Checker
Syntastic is a syntax checking plugin that runs files through external syntax checkers. This can be done on demand, or automatically as files are saved and opened.
Intall Syntastic via Bundle.
1 2 3 |
|
Install NodeJS
1 2 3 4 5 |
|
Source: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
Install The Node Package Manager
1 2 3 4 5 6 7 8 9 10 |
|
Install JSHint
1 2 3 4 5 6 7 8 |
|
Create a .jshintrc
file in your home directory.
Source: https://github.com/jshint/jshint/blob/master/examples/.jshintrc
Option Reference: http://www.jshint.com/docs/
Javascript Coding Standard - Run the JSHint
Run :SyntasticCheck
on a Javascript file. Fix Errors and Warnings.
You can also check your code on http://www.jslint.com and http://www.jshint.com
Sample .jshintrc Files
https://github.com/jquery/jquery/blob/master/.jshintrc https://github.com/mozilla/browserid/blob/dev/.jshintrc
Install UglifyJS2
npm install uglify-js@1
https://github.com/mishoo/UglifyJS
Now uglify, uglify filename.js > filename.min.js
.
Now you know the basics of how to write clean jQuery code and compress them to save bandwidth and improve page load time !