javascript - How to use jquery plugins in nodejs and ES6 import? -
i'm using jquery plugin calendar http://kylestetz.github.io/clndr/ i'm using cdn want use nodejs module best way ?
edit: i'm using babel transpiler , es6 syntax.
if plugin has not been written es6 module need yourself. since jquery plugins attach existing jquery object don't export of note. can wrap plugin in invoked function , export that. remember either import jquery in plugin file or make available globally.
import jquery 'jquery'; const calendar = (function ($) { ... jquery plugin code ... can live here }(jquery));
if feel inclined learn fork project , rewrite plugin code es6 class , make available on npm others.
Comments
Post a Comment