简体   繁体   English

在node.js中如何使用客户端库?

[英]How are client-side libraries used in node.js?

I am new to node.js and just discovered npm, which has been a pretty handy tool. 我是node.js的新手,只是发现了npm,它已经是一个非常方便的工具。 However, I noticed that a lot of libraries that I have used before in client side JavaScript programming, such as jquery and d3, can be installed using npm. 但是,我注意到,我以前在客户端JavaScript编程中使用过的许多库(例如jquery和d3)都可以使用npm安装。 It seems strange to me to install these libraries as node modules as I don't understand how to use something like d3, useful for data visualization, in node. 将这些库安装为节点模块对我来说似乎很奇怪,因为我不了解如何在节点中使用像d3这样对数据可视化有用的东西。 Is it just because npm is a convenient way to download JavaScript code even if the libraries are not to be used with node? 仅仅是因为npm是即使不将这些库与node一起使用也可以方便地下载JavaScript代码的方式吗?

Remember how you should not parse html with regex ? 还记得您不应该使用正则表达式解析html吗? Yeah, you should parse html into a dom and manipulate that. 是的,您应该将html解析为一个dom并对其进行操作。 jQuery and d3 make this easier on server-side. jQuery和d3在服务器端使此操作更加容易。

There is also a jQuery port even for PHP 即使是PHP也有一个jQuery端口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM