https://github.com/devbridie/unjquerify
AST-based tool for converting jQuery code to modern vanilla JavaScript
https://github.com/devbridie/unjquerify
ast babel-plugin dom jquery
Last synced: about 2 months ago
JSON representation
AST-based tool for converting jQuery code to modern vanilla JavaScript
- Host: GitHub
- URL: https://github.com/devbridie/unjquerify
- Owner: devbridie
- License: mit
- Created: 2018-05-07T05:45:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-07T23:46:00.000Z (over 6 years ago)
- Last Synced: 2025-03-21T06:51:22.363Z (2 months ago)
- Topics: ast, babel-plugin, dom, jquery
- Language: TypeScript
- Homepage: https://unjquerify.com
- Size: 261 KB
- Stars: 16
- Watchers: 1
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unjQuerify
UnjQuerify is a project that can assist developers in migrating code from jQuery to vanilla DOM APIs.**In**:
```javascript
$("#submit").click(function() {
$("#output").text("The button was clicked!");
$(".post").hide();
});
```**Output**:
```javascript
document.getElementById("submit").addEventListener("click", function () {
document.getElementById("output").textContent = "The button was clicked!";
document.getElementsByClassName("post").map((_element) => _element.style.display = "none");
});
```## Built With
* [`babel`](https://babeljs.io/) to build an AST and to transform nodes.## Usage
### CLI
* Ensure that `npm` is available.
* Use `npm install` to install dependencies.
* Run unjQuerify with the provided example script: `npm --silent start sample/simple.js`.
* Verify that the console shows the transformed script.### As dependency
* Ensure that `npm` is available.
* Run `npm install unjquerify`.
* Import unjQuerify's plugins using `require('unjquerify/build/src/all-plugins')`` or a similar method.## Contributing
Contributions are always welcome. Please see this [project's issue tracker](https://github.com/devbridie/unjquerify/issues).Some useful resources are the following:
* [Babel Plugin Handbook](https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook)
* [AST Explorer](https://astexplorer.net/#/gist/02b98eb0c96ef8d4762fb5a87a71b849/4ce7c810fc6e6aa48684a656f8b1b06b581e9b02)
* [You Don't Need jQuery](https://github.com/nefe/You-Dont-Need-jQuery)
* [jQuery API Documentation](http://api.jquery.com/)Before submitting a pull request, please verify that your changes pass linting (run with `npm run lint`). Please include tests for new features.