I know all internal jQuery functions are written in JavaScript, so it should technically be possible to just evaluate jQuery to JavaScript.
I have a snippet of JavaScript that uses jQuery that I need to use in an environment where jQuery isn't available. I know I could translate it by hand, but it is quite a lot of code. Is there a tool out that that does this?
Just to make it clear: with a lot of effort I could probably get jQuery in the environment but I would like to have a solution that is a bit more resource friendly. If there is no tool like this I'll just try to translate the code by hand, I was just wondering whether there was such a tool.
Any ES5 code is valid ES6 code. And Babel only transpiles newer features into older equivalent code, not the other way round (detecting patterns in ES5 that could be expressed differently in ES6). You should aim to write ES6 as the source. There is no automated conversion of ES5 to ES6.
Babel is a free and open-source JavaScript transcompiler that is mainly used to convert ECMAScript 2015+ (ES6+) code into backwards-compatible JavaScript code that can be run by older JavaScript engines. It allows web developers to take advantage of the newest features of the language. Babel.
Google's Closure Compiler's advanced optimization compresses your code to only include parts that are necessary, so the parts of jQuery that aren't used are stripped away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With