I am currently writing the front-end for a large python application and have realized that I would benefit a lot from various Node packages (I am currently trying to make it into a single page ReactJS application).
我目前正在编写一个大型python应用程序的前端,并且已经意识到我将从各种Node包中受益匪浅(我目前正在尝试将其转换为单页ReactJS应用程序)。
From my understanding though, in most tutorials, Node seems to be used for the entire application. In my case I just want the front-end. So my question is how can I do that? Do I simply do an npm init in the folder where my front-end JS files are and install whatever packages I need? If not, how do I do this? Is this even an appropriate use of Node?
根据我的理解,在大多数教程中,Node似乎用于整个应用程序。就我而言,我只想要前端。所以我的问题是我该怎么做?我只是在我的前端JS文件所在的文件夹中执行npm init并安装我需要的任何软件包吗?如果没有,我该怎么做?这甚至是Node的合适用途吗?
Thanks
1 个解决方案
#1
1
Node.js doesn't run on the frontend but on the backend - you can use Node instead of Python.
Node.js不在前端运行,而是在后端运行 - 您可以使用Node而不是Python。
You can use Node to prepare/compile/build/minify your frontend code.
您可以使用Node来准备/编译/构建/缩小您的前端代码。
You can use npm
modules on the frontend - see Browserify.
您可以在前端使用npm模块 - 请参阅Browserify。
But you will not be able to run Node on the frontend - unless you want something like repl.it.
但是你不能在前端运行Node - 除非你想要像repl.it这样的东西。
#1
1
Node.js doesn't run on the frontend but on the backend - you can use Node instead of Python.
Node.js不在前端运行,而是在后端运行 - 您可以使用Node而不是Python。
You can use Node to prepare/compile/build/minify your frontend code.
您可以使用Node来准备/编译/构建/缩小您的前端代码。
You can use npm
modules on the frontend - see Browserify.
您可以在前端使用npm模块 - 请参阅Browserify。
But you will not be able to run Node on the frontend - unless you want something like repl.it.
但是你不能在前端运行Node - 除非你想要像repl.it这样的东西。