Paste jQuery, get plain JavaScript. The output is a small, chainable utility that stands in for jQuery, so your existing code keeps working without a rewrite.
No JavaScript for these methods yet:
Many projects use a small fraction of jQuery, and modern browsers cover that fraction natively. Dropping the library is usually worth it; rewriting every call site is not. The converter does the rewrite for you.
The tool reads the jQuery methods your code calls and generates a utility that implements only those. Your calls do not change; jQuery itself does.
The generated methods chain like jQuery’s and are written in modern JavaScript with full test coverage, so the utility is small enough to read.
Conversion happens in your browser; nothing is uploaded. The same engine ships as a CLI for whole projects and continuous integration.
It turns the jQuery your code uses into plain JavaScript: a small utility that replaces the jQuery library while your original code stays unchanged.
No. The generated JavaScript is a drop-in for jQuery, so the code you already have runs as before, without the jQuery library.
All modern browsers, and Internet Explorer 11 and newer, so the output works across the environments your users have.
Most of them. For a few, such as Ajax, a small dedicated library is the better replacement; the converter tells you which methods it skipped. The full list of supported methods is in the repository.
Your source is parsed into an abstract syntax tree. The tool walks the tree, finds the jQuery methods in use and emits the matching vanilla implementations from its tested library, then formats the result.
Yes. For many files, use the CLI below: it batch-processes files that match a pattern and writes one utility for the whole project.
Not yet. The project is open source and contributions are welcome if you would like to build one.
The same converter as a command line tool, for many files at once and for build pipelines.
Install it from npm:
npm install -g replace-jqueryConvert one file, writing the vanilla JavaScript to another:
replace-jquery src/sample.js out.jsConvert every file that matches a pattern:
replace-jquery "src/*.js" out.jsGenerate vanilla alternatives for every jQuery method the tool knows:
replace-jquery --build-all out.jsOr only for the methods you name:
replace-jquery --methods "addClass, removeClass, attr" -o utils.jsThe generated utilities are not equivalent to jQuery in every edge case. Treat the output as a starting point and test it before you adopt it.