- It has to parse whole page to find all scripts so some unncessary overhead is added.
- It bundles all inline scripts into single script before body closing tag and does not respect script dependecies on external scripts.
- If you are using System.Web.Optimization and Bundles you are all set beacuse it comes with WebGrease.dll that we will use for minification otherwise you can get it here – WebGrease NuGet package.
- We will use this helper
- And inside your Razor view:
- When view is rendered you get minified version:
You can fine tune minification using CodeSettings object passed to minifier. As far as performace in concerned on average development machine it usually takes less that 1 millesecond to minify single inline script.