可以 grunt 服务器用于生产应用程序部署 [英] can grunt server use for production application deployment

查看:19
本文介绍了可以 grunt 服务器用于生产应用程序部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新人,我想知道 Grunt 服务器是否能够处理生产应用程序部署.

i am at fresher level,i want to know about the Grunt server is able to handle production application deployment.

..请帮我.

推荐答案

是的,您可以在生产环境中运行 grunt,您可以查看这篇文章了解如何操作.

Yes you can run grunt in production, You can see this post for how to do it.

gruntjs 服务器任务的目的是什么?

但是,我不建议这样做.

Grunt 服务器基本上旨在帮助开发人员运行您的应用程序,而无需使用实际服务器.除了提供页面之外,它还执行一些任务,例如编译 sass、减少文件和使用 live-reload 重新加载页面等.每当您根据您在 Gruntfile.js

Grunt server is basically designed to help the developer to run your app, without using an actual server. Apart from serving pages, It does some tasks like compiling sass, less files and reloading the page using live-reload, etc,. whenever you change these files and any additional tasks based on the config you provide in Gruntfile.js

但是在生产服务器中,您可能会期望有大量流量,并且每次文件更改时都需要重新编译文件,而且一切都很混乱.我认为 Grunt 服务器无法处理生产中的流量和所有任务,您的站点可能会变得非常缓慢.

But in a production server, you might expect a lot of traffic and every time files changes recompiling the files and all is lot of mess. I don't think Grunt server can handle the traffic in production and all the tasks, your site may become very slow.

另外Angular 是前端框架,那么您打算如何将任何 Web 服务与它一起使用?要运行 Web 服务,您可能正在运行 Apache 或节点服务器.这样您就可以在同一台服务器上部署您的应用构建.

Also Angular is front-end framework, so how do you plan to use any web services with it? To run web services you might be running Apache or node server. so you can deploy your app build in the same server.

您可以在开发中完成所有这些工作,然后构建应用程序并将其放置在生产站点中

You can do all these in your development and you build the app and place it in production site

您可以使用 Grunt Build 命令来构建您的 Angular 应用程序,它会在 dist 文件夹中提供缩小的 javascript、css 和其他内容

You can use Grunt Build command to build your angular app and it will give minified javascript, css and other things in dist folder

您可以在您的生产服务器中部署这个缩小的应用程序.传输到客户端的代码非常少,因此您可以减少服务器上的大量带宽压力,并且您的应用程序会更快.

You can deploy this minified app in your production server. very less code is transfered to the client so you can reduce lot of bandwidth stress on the server and your application will be faster.

明智地选择:)

这篇关于可以 grunt 服务器用于生产应用程序部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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