4 ms·
So happy to see official jQuery releases on npm. No more need for unmaintained third-party jquery-{browser,browserify,client,etc} packages.
by quarterto 13y ago
So happy to see official jQuery releases on npm. No more need for unmaintained third-party jquery-{browser,browserify,client,etc} packages.
- ancarda 13y agoCan I ask why you would want jQuery on npm? A lot of jQuery's use is DOM manipulation, something that as far as I'm aware doesn't exist on Node.js
- ramigb 13y agojQuery has much more than DOM manipulation, but since you mentioned that, some packages like Cheerio uses jQuery -to some extent- to parse DOM on scrapped HTML pages, and of course you can use jQuery to create DOM elements and append them to responds although not efficient but i am just giving examples from the top of my head here :)
- Encosia 13y agoTo my knowledge, Cheerio (which is great) does not depend on jQuery. I believe it just implements a limited selector, traversal, and manipulation API that's very similar to a subset of jQuery's API over the browser DOM.
- ramigb 13y agoExactly "Cheerio implements a subset of core jQuery" it does not depend directly on jQuery as a dependency but it does use it.
- Encosia 13y agoNot sure I understand what that has to do with jQuery being on npm. The only way that Cheerio uses jQuery is by choosing its popular API to implement an interface to scraped pages in.
- camus2 13y agoBecause jQuery is a Javascript library,,and dev might want to test/build their own jQuery.
- lobster_johnson 13y agoIt's mainly so that you can use Browserify [1]. Browserify and Bower both integrate the Node.js module system into client-side JS. You basically get a unification of backend and frontend languages -- both using JS, the same dependency and versioning system, the same way to require modules, and of course the same code. Being able to use the same libraries on the backend and frontend is huge. (But not required. Browserify/npm are still useful if you don't use Node.js.) And it's cleaner. Relying on the Node.js dependency system means you can just import modules the same was in Node.js, instead of maintaining an ugly "vendor/" folder where you manually copy things like jQuery. I suspect (I haven't gotten this far yet) that you can more easily unit-test your code this way. You just need a "headless" browser environment (using jsdom etc.) that's compatible jQuery. Browserify is actually very small tool. It leaves all package management to npm, and all Browserify does is to generate a JS file that includes all your package.json-specified modules in neatly namedspaced dependency-initialization order, ready to be imported using a script tag. There is also Bower [2] from Twitter. Unlike Browserify, Bower is mainly a wrapper around npm that acts as a separate package manager, but doesn't actually implement the glue needed to import any JS on the client side. [1] http://browserify.org http://browserify.org [2] http://bower.io http://bower.io
- andreypopp 13y agoNot sure if bower has something to do with npm cause it's a separate package manager.
- lobster_johnson 13y agoYou're absolutely right. I thought it was based on nom, but it's not.
- brokenparser 13y agoGreat, now I just need a third-party package manager that only runs on their own javascript environment. Whenever I write a web application in something other than javascript (happens), that's quite a build dependency right there. I'd rather not have Ruby gems and npm packages in a Python project, for example.