3 ms·
I believe the following project does exactly that: WebMarkupMin.AspNetCore2. The one consideration to this project is that the minifications are done at runtime
by bobblywobbles 8y ago
I believe the following project does exactly that: WebMarkupMin.AspNetCore2. The one consideration to this project is that the minifications are done at runtime.
Doing the minification before the application starts saves time from a pipeline minifying on the fly.
- zamalek 8y agoThe easiest hypothetical option would be to instruct the .cshtml code generator to ignore insignificant whitespace, but I don't think it currently supports that.
- bobblywobbles 8y agoWebMarkupMin doesn't support that?
- zamalek 8y agoI think it does post-processing on the HTML once it has been generated. ASP.Net works by generating an assembly from source files (like .cshtml) that essentially amounts to a whole bunch of `Response.Write("<HTML>")`. If it (Razor in this case) could be made aware of insignificant whitespace, it could omit the writes for whitespace.
- Novashi 8y ago>Doing the minification before the application starts saves time from a pipeline minifying on the fly. That would only affect a cold-start (app pool recycle) or a view recompile before that'd be an performance concern, unless I don't understand how/when views are cached and then evicted from cache. If you have a lot of views with a lot of partial views inside them, then yeah, you'd only want to run minification once on the final view, instead of for every partial view. I'm not sure if you'd have (or want) that much control over the view rendering process. Btw it's a cool post if you're the author.
- bobblywobbles 8y agoYes, those points are true. And yes, I am the author.