我正在尝试一些现代 Javascript 框架,例如 Angular、React、Vue 和 Ember,它们都希望我使用构建工具,例如 npm
、grunt
、gulp
、maven
等
I'm trying out some modern Javascript frameworks like Angular, React, Vue and Ember, and they all want me to use build tools like npm
, grunt
, gulp
, maven
, etc.
Web 编程曾经很有趣.只需更改一些文件,刷新浏览器,看看它是否有效.现在每次我改变一些东西,我都必须重新构建它,这需要相当长的时间.我真的很讨厌看到网络编程变成了这样.我知道构建甚至可以使用这些工具自动完成,监视文件更改等,但仍然很糟糕.
Web-programming used to be fun. Just change some files, refresh the browser and see if it works. Now every time I change something, I have to build it again, which takes quite some time. I really hate to see that web-programming has become like this. I know the building can even be done automatically with these tools watching for file-changes, etc., but still, it just sucks.
我的问题是,当我想使用上述框架之一时,我应该在每次运行时都使用构建工具,还是只需要这些用于部署和测试目的(或者根本不需要) ?
My question is, when I want to use one of the mentioned frameworks, am I supposed to use the build-tools every time I want to run, or do I just need these for deployment and testing purposes (or not at all) ?
有些库需要构建代码,有些则不需要.从您拥有的列表中,它们在技术上都不需要它.它们都可以通过简单地将 js 文件包含在 <script>
标记中来工作.但是,有许多框架/库(例如 sass 或 coffeescript)确实需要构建工具,因为必须将源代码编译为浏览器所理解的 html/javascript/css.
Some libraries require building the code, some don't. From the list that you had, none of them require it technically. They can all work by simply including the js file in a <script>
tag. However, there are many frameworks/libraries (such as sass or coffeescript) which do require a build tool, because the source code must be compiled to become html/javascript/css as understood by the browser.
此外,没有任何理由反对使用构建工具.正如您所说,它们可以在文件更改时自动运行,因此它们实际上只是在后台.
Also, there's not really any reason to be so against using build tools. As you said, they can run automatically on file change, so they're really just in the background.
这篇关于在没有构建工具(如 grunt 和 gulp)的情况下使用 Javascript 框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!