Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to minify CSS and JavaScript files in Visual Studio 2015

Tags:

I am building a web application for mobile using visual studio, and I wanted to know how do I minify all my CSS files into one file, and also all my JavaScript to one minified file.

like image 941
Bergerova Avatar asked Aug 11 '15 05:08

Bergerova


People also ask

How do you minify JavaScript in VS code?

A Minify button should appear in the status bar when opening a . js or a . css file. You can also run Minify: Document by clicking F1 or CTRL+SHIFT+P .

What bundle would you use to minify CSS and/or JavaScript on a production environment?

Click on wwwroot folder, select the css file you want minified, then right click and choose bundler & minifier. Then from popup minify file. It will be the same file name with the minified version.


2 Answers

You can use the Visual Studio 2015 Bundler & Minifier,extention https://visualstudiogallery.msdn.microsoft.com/9ec27da7-e24b-4d56-8064-fd7e88ac1c40 this used to be apart of Web Essentials in previous versions of Visual Studio, but was separated, into it's own extension.

like image 54
Dwain Browne Avatar answered Sep 21 '22 10:09

Dwain Browne


The below link explains a lot better http://blogs.msdn.com/b/rickandy/archive/2012/08/15/adding-web-optimization-to-a-web-pages-site.aspx

http://www.asp.net/mvc/overview/performance/bundling-and-minification

like image 20
Deepak Rajappan Avatar answered Sep 18 '22 10:09

Deepak Rajappan