5

I use traceur / babel to transpile ES6 to ES5 but is it possible to use an gulp plugin to transpile jQuery to plain javascript? Thanks for Your answers :)

JustFCO
  • 101
  • 1
  • 4
  • 1
    jQuery isn't a different language, it's a library to extend the functionality of javascript. Please read up on jQuery first. – Patrick Bell Jun 28 '16 at 11:04
  • Why would you even do that ? You can already execute jQuery on any browser unlike ES6. – Walfrat Jun 28 '16 at 11:06
  • 2
    I know that jQery and Vanilla /plain JS are the same language and that jQuery has nice ways to handle DOM elements and simplifies the code. We have a customer who does not want to use jQuery and therefore we have to translate the jQuery scripts into plain JS. – JustFCO Jun 28 '16 at 14:43
  • Why is this tagged with `gulp`, `babeljs`, `traceur`? – trincot Apr 21 '23 at 12:18

3 Answers3

3

There is no gulp plugin to transpile jQuery to javascript. This is somewhat related to this question Is there an easy way to convert jquery code to javascript? . What you would need to do is to find out what you are doing with jQuery and look up ways of doing it with vanilla javascript instead and then you would not need jQuery.

Community
  • 1
  • 1
spoq
  • 193
  • 2
  • 9
  • :( I haven't been able to find anything either. If you're going to do it, please write a plugin for it!!!! How many thousands of hours have people wasted on this when the first person to do it could have written a plugin. Or better, the person that spent a lot of time writing this site: http://youmightnotneedjquery.com/ (which could probably more or less automatically be converted into a gulp plugin, lol) – DylanYoung Jul 17 '20 at 20:46
0

Actually you can google for a tool to convert it. There are a lot. Here is one for example: https://www.workversatile.com/jquery-to-javascript-converter

Just copy -> paste your jQuery code and convert it.

Just be careful and try to convert the code step by step, because there might be some bugs and errors.

Edmon Belchev
  • 337
  • 2
  • 8
-5

You can open the jquery.js and look for the relevant functions you want to convert to native javascript.

Copy it into a new helper.js, include it instead of jquery.js (or jquery.min.js) and use this functions. Voila, native js-functions.

Marcel Ennix
  • 1,328
  • 1
  • 12
  • 16