![]() ![]() the Node.Js command prompt with Admin rights is at : C:\Windows\System32 Navigate to the Angular project folder from the command prompt. Once done, to install Grunt.js, open the Command Prompt of Node.js with Admin rights. Before installing Grunt.js, since it has a dependency on the Node.js, node must be installed first. Step 3: Now install Grunt for the project. We will be implementing Grunt Tasks for implementing concatenation and minification in this folder path. In this project we have Module.js, Service.js and Controller.js JavaScript files in the MyScripts sub-folder of the Scripts folder. Open the Angular application downloaded from the Step 1. Step 2: Open Visual Studio 2013 (the article is developed using ultimate edition with Update 3 although you should be able to use the free Visual Studio Community Edition as well). Download the application and open it in Visual Studio. This application can be downloaded from here. Step 1: To demonstrate Grunt.js to do various tasks as discussed above, we will use an MVC application and perform CRUD operations using Angular.js and ASP.NET WEB API. Implementing Grunt.js in an ASP.NET MVC application This article will only focus on using Grunt to concatenate and minify JavaScript files. Once Node.js is installed on the machine, we can get the needed plugin using Node.js Command Prompt. ![]() ![]() We also need Grunt.js Task Runner Explorer and NPM/Browser Package Intellisense. To use Grunt.js with an ASP.NET MVC application in Visual Studio 2013, we need to have Grunt Launcher extension for Visual Studio which can be downloaded from here. The list and information about Grunt Plugins can be grabbed from here. Since Grunt has dependency on Node.js, Grunt and all its plugins are installed and managed via npm, which is the Node.js package manager. The Grunt ecosystem provides various plugins for performing automated tasks on JavaScript. Grunt.js helps to automate client-side tasks like minifying the script files, merging them, performing unit testing etc. What would help here is if the developer is provided with a ready framework which will automate tasks for minifying the scripts and concatenating large JavaScript files together as well as also help in Unit Testing JavaScript. Another issue is unit testing this complex functionality. However as the logic and functionality increases, so does the size of the JavaScript files. In current web apps, client-side logic is used to perform complex operations like routing, service calls, validations etc. In an application that involves both server-side (like ASP.NET MVC) and client-side code (like JavaScript, Angular.js etc), a web developer usually ends up with several JavaScript files meant for different functionalities in the application. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |