问题
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 :)
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/38074387/is-it-possible-to-transpile-jquery-to-vanilla-js