什么是AngularJS node_modules目录? [英] What is node_modules directory in AngularJS?

查看:1812
本文介绍了什么是AngularJS node_modules目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在探索 AngularJS教程项目,发现它具有 node_modules 目录里面,它的大小,如果60兆字节。

I am exploring AngularJS tutorial project and found it has node_modules directory inside, which size if 60 megabytes.

请问简单的JavaScript客户方项目确实需要未知数据,以便庞大的语料库?

Does simple clientside javascript project really need so huge corpus of unknown data?

我试图删除这个目录和项目仍然有效。我怀疑它在某种程度上与的node.js 涉及,它的 NPM 但如何?假设我需要一些常规的Web服务器(不node.js的),那么怎么知道,哪些文件/目录是不需要上运行我的项目?

I tried to delete this directory and project still works. I suspect it somehow relates with node.js and it's npm but how? Suppose I need to run my project on some conventional web server (not node.js), then how to know, which files/directories are unneeded?

许多JavaScript库需要使用凉亭安装它们。如果我使用的凉亭,这是否意味着我需要保持 node_modules

Many javascript libraries require to use bower to install them. If I use bower, does this mean I need to keep node_modules?

推荐答案

node_modules 目录仅适用的构建工具

在应用程序根目录的的package.json 文件定义了库将被安装到 node_modules 当您运行 NPM安装

The package.json file in the app root defines what libraries will be installed into node_modules when you run npm install.

很多时候带有棱角的应用程序,在您的开发计算机或生成服务器上,您使用来自NPM其他JavaScript库(一个Node.js的包管理器),以建立自己的角度应用程序。任务可以串联的资源,使用CSS preprocessors一样都不能少或SASS,缩小,价值观等,等,为管理和运行这些任务的最常用的工具的替换被称为的咕噜一饮而尽的,它们通过NPM安装好了。

Very often with an angular app, on your dev machine or on a build server, you use other Javascript libraries from npm (a node.js package manager) to build your angular app. Tasks can be concatenating resources, using CSS preprocessors like LESS or SASS, minification, replacing of values, etc. etc. The most common tools for managing and running these tasks are called grunt and gulp, which are installed through npm as well.

在部署应用程序,你只发布最终版本,没有任何一个源文件或创建工具。

When you deploy your app, you only distribute the resulting build, not any of the source files or build tools.

这当然是可以编写应用程序AngularJS没有任何建设

It is of course possible to write an AngularJS app without building anything.

从评论编辑:当你潜入角多,有即使在客户端应用程序通过使用安装NPM库更先进的技术,你再有选择性地选择你需要的那些,而不是整个50MB +事情。我建议的基本途径住,直到你在他们身上得到了很好的把握,虽然。

edit from comments: When you dive into Angular more, there are more advanced techniques of using libraries installed by npm even in the client app, you then selectively choose the ones you need, not the whole 50MB+ thing. I'd recommend staying with the basic approaches until you get a good grasp on them though.

这篇关于什么是AngularJS node_modules目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆