Since the jquery npm package explanation is kind of rough and doesn’t include instructions for building a custom 1.x version, here’s a short list of steps.
// Assuming you are familiar with Grunt and have it installed
// This is written in the time of jquery 1.11.0 / 2.1.0
Setup
Reserve a folder just for building jquery. I recommended keeping this outside a project folder since it will take a lot of disk space and files you don’t want in your git repo and live app resources.
cd your_folder
git clone git://github.com/jquery/jquery.git And wait for it to download about 23mb.
For jquery 1.x: git clone -b 1.x-master git://github.com/jquery/jquery.git
cd jquery
npm install To install necessary npm modules to build jquery (about 50mb)
grunt Will build jquery into jquery/dist/
Custom build options
Customizing the build is mostly useful for excluding unneeded modules and thus saving filesize. See https://github.com/jquery/jquery/tree/master/src for a list of modules. Instead of just running “grunt” in the last step of the setup, modify the command to exclude modules (take the [folder/]filename without “.js” and note that “core” and “selector” are always required):
grunt custom:-ajax To exclude the ajax module
grunt custom:-ajax,-css To exclude the ajax and css module
For the current version of frique.me I’m using the following custom build which saved about 12kB. grunt custom:-deprecated,-event/alias,-wrap,-core/ready,-exports/amd,-ajax