Skip to content
Mobify.js was a JavaScript framework for optimizing sites for mobile. It is no longer actively maintained.
JavaScript CSS HTML Other
Branch: v2.0
Clone or download

Latest commit

donnielrt Merge pull request #306 from mobify/ios-preload-hit-fix
Added iOS8 preload-top-hits issue fix for v7 tag
Latest commit 4a4ff8a Sep 24, 2015


Type Name Latest commit message Commit time
Failed to load latest commit information.
build Fix deployment Sep 16, 2015
examples Fixes some issues with picture that have to do with the latest spec Oct 20, 2014
performance Fixes a regression that will cause inline scripts to be removed when … Jul 29, 2013
src Move capture and cssOptimize to separate repos Dec 31, 2014
tag Update minified v7 tag Jul 29, 2015
tests Fix tests Dec 31, 2014
www Fix deployment Sep 16, 2015
.gitattributes Initial Commit. Jun 1, 2012
.gitignore Merge remote-tracking branch 'origin/v2.0' into v2.0-modularization-o… Mar 25, 2014
.gitmodules Resize the Picture element as well! Jun 5, 2013
.npmignore Adding npmignore file Mar 18, 2014
CHANGELOG Bumping to the latest capturing Sep 16, 2015
Gruntfile.js Further fixes Sep 16, 2015
LICENSE Add License Jun 1, 2012
Makefile dd bower_componenets to gitignore, fix automated installation to user… Feb 25, 2014
Procfile Changes to get performance tests served on Heroku Jul 4, 2013 Fix clone URL. Aug 11, 2015
bower.json Fix deployment Sep 16, 2015
circle.yml Run make install before tests Mar 8, 2013
mobify-custom.js.example Updating the custom example file Mar 4, 2014
mobifyjs Updating all the links so that I can use relative paths in the exampl… Feb 28, 2013
package.json Fix deployment Sep 16, 2015
server.js Remove special open source tag Feb 12, 2014


Mobify.js is an open source library for improving the performance of websites by providing responsive images, and optimized JS/CSS. It does this by using capture.js to control the resources on the page, and uses resizeImages.js, jazzcat.js, and cssOptimize.js to change the resources on the page to point to Mobify's proxy services to optimize the resources.

For instructions on how to use the library, follow the instructions on or build the docs site manually in the instructions below.



Mobify.js uses Bower, Grunt.js and Require.js to build the library, and manage all of the dependencies. First, you will need to install the grunt-cli globally:

npm install -g grunt-cli

And then download the latest code from git and install the dependancies:

git clone
cd mobifyjs
npm install
bower install

Now, to build the library, simply run the following command:

grunt build

Open the build folder to see the generated Mobify.js libraries.

Mobify.js is built with AMD modules using almond.js.

In order to build Mobify.js during development without having to run grunt build everytime you change a file, run the following command:

grunt serve

This will run a development server on http://localhost:3000 using connect, and build the library every time the files in src change.

To see how the project is setup to build, open up Gruntfile.js and have a look!

Build Setup

Require.js is used to build Mobify.js.

  • src/config.js # The require.js base config for all build mobify.js builds
  • src/mobify-library.js # Defines how to build the full mobify.js library

There is also an example custom build file to make it simple to build a custom mobify.js library (or to compile the library with executable code):

  • mobify-custom.js.example

To create a custom build, run the following:

`cp mobify-custom.js.example mobify-custom.js`

Then, run grunt serve as normal. The output of the custom build will be located in build/custom.

Note: We use a mobifyjs symlink to resolve paths so they can be the same locally as they are on the CDN. This can be problematic for Windows.


Tests for Mobify.js are written in QUnit. To run them individually, run grunt serve and then go to http://localhost:3000/tests/capture.html or any other of the QUnit tests in the /tests/ folder.

To run all of the tests in an automated fashion using Phantomjs (the headless webkit browser) run the following command:

grunt test

It's also important when developing not to run into any regressions on all of the supported browsers. The Gruntfile is setup to be able to run qunit tests on many browsers we support (in order to do this yourself, you will need to set SAUCE_USERNAME and SAUCE_KEY in your environment variables).

grunt saucelabs


By default, the deploy command is set to deploy Mobify.js to To deploy here, ensure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set in your environment variables.

grunt deploy

Browser support

Using Capturing:

  • All Webkit browsers (Safari, Chrome, Netfront, etc)
  • Firefox - version 4 and up
  • Opera - 11 and up (previous versions untested)
  • IE - 10 and up

Not Using Capturing:

Support for using the API without Capturing has not been tested, but it will at minimum support the browsers listed above (as well, it should cover many older browsers)


The compiled documentation for Mobify.js can be found online at

The static site is built with Jekyll. Run the following commands to get the docs running locally:

gem install jekyll
grunt jekyll

Then navigate to http://localhost:4000/mobifyjs/docs/.

You can’t perform that action at this time.