
It describes the property activity to perform and its dependency with the generation of resources. What I usually do, is to go to the end of the file and then add the following line just before the closing Project tag: csproj’ option, which will open the XML editor of the Visual Studio with the project’s configuration. Once unloaded, right-click it again and choose the ‘Edit. The first step is to unload the web application project by right-clicking on it and choose the option ‘Unload Project’.

The answer is quite easy: we must use MSBuild in the web application project file to configure the Microsoft Ajax Minifier to be executed as a task when publishing in ‘Release’ mode.
#Visual studio minify javascript how to
It is not advisable to minify your web application’s JavaScript and CSS files during developing time it should be done on deployment or publish (for testing or any other purpose) time.īut then, how to minify those files without affecting the original source code in the solution when deploying it? NET professional, so in this and future post, I will going to focus only on Microsoft’s Ajax Minifier tool. There are many tools to minify JavaScript and CSS files, like for example: This improves response time performance because the size of the downloaded file is reduced. When code is minified all comments are removed, as well as unneeded white space characters (like newlines or tabs). Minification is the practice of removing unnecessary characters from code to reduce its size thereby improving load times. However, if their size is big, you may improve the first request load time by reducing their size.

You may think that actually this is not very helpful since using external JavaScript and CSS files in the real world generally produces faster pages because they will be cached by the browser. One of the best practices to speed up a web site or web application is to minify JavaScript and CSS files which as a secondary effect, not only reduces the size of those files but also makes them harder to read (something helpful to prevent the stealing of your ideas and efforts).
