Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can grunt server use for production application deployment

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

.. please help me.

like image 996
Atul Jain Avatar asked Mar 22 '14 12:03

Atul Jain


People also ask

What do you use grunt for?

Grunt is a command line Javascript task runner utilizing Node. js platform. It runs custom defined repetitious tasks and manages process automation. The project's homepage lists many big players in software development that use Grunt in their development as part of continuous integration workflow.

What is grunt in Angularjs?

Grunt is very popular build tool for creation build and deployment of application. Grunt JS is responsible to automate all thing after development, it's very handy and easy to use, We have learn how to install grunt and use GRUNT in your application, here is I am describing use of grunt with angular application.


2 Answers

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

What's the purpose of gruntjs server task?

But, i woudn't recommend that.

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

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.

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

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.

Choose Wisely :)

like image 120
Vamsi Avatar answered Sep 22 '22 17:09

Vamsi


Yes, you can. But to do it would be madness. So... I'd say no, don't do it.

A Grunt "server" (in quotes because it actually runs on top of NodeJS) is only meant for local development. However, Grunt runs on NodeJS, and with the help of some frameworks like ExpressJS you can get something to work on NodeJS. See this Deploying a production Node.js server.

Grunt is a task runner, it's meant to help one develop faster. But Grunt won't deliver production-ready builds every time you run tasks. It will help you get there by letting you know what you need to fix to get a production-ready build. When you do that - and only then - you may release the latest build. Combine it with a version control tool like Git and you are covered.

Make sure you are self-employed before serving live Grunt builds on a production server, so you don't loose your job... :)

like image 40
Wallace Sidhrée Avatar answered Sep 26 '22 17:09

Wallace Sidhrée