I know I have seen an article this somewhere (specifically related to Azure too!) but I forgot to bookmark it (doh!) and after hours searching can't find it anywhere :(
I have a MVC Application running in Azure with multiple layout pages and roughly 20+ javascript files (each quite lengthy hence why they are seperate!).
Each layout page includes a couple of script and css files, the rest are added using @head { }
(razor syntax for adding sections to the layout page outside of the body.
I cannot remember if the article was exactly what I was after but what I would like to do is combine AND minify the nessessary javascript and css files at runtime dependant on the layout and page.
For example if i had a layout file with:
<script src="script1.js"></script>
<script src="script2.js"></script>
<link href="css1.css" />
and a page with
<script src="pagespecificscript.js"></script>
<script src="usercontrolspecificscript.js"></script>
<link href="page.css" />
I would want a 2 minified files to be sent to the user's browser such as
<script src="201101010800abc-min.js"></script>
<link href="201101010800abc-min.css" />
Thanks in advance!
-
Check out this question stackoverflow.com/questions/6738117/…Ivo– Ivo2011年10月04日 10:12:51 +00:00Commented Oct 4, 2011 at 10:12
1 Answer 1
Check out RequestReduce. Its a project I have been working on that minifies/merges css and optimizes and sprites images. It does this on the fly with no code changes and very little confg necessary. Next week, I will be releasing javascript merge/minify. I have been blogging quite a bit about this lately (http://www.mattwrock.com/post/2011/09/10/Adopt-RequestReduce-and-see-immediate-Yslow-and-Google-Page-Speed-score-improvements-not-to-mention-a-faster-site!.aspx) so it is possible that this is the article that you had run into. The easiest way to grab RequestReduce is via nuget: Install-Package RequestReduce.
I'm a dev lead on a couple Microsoft web sites where we have been deploying this with good success, so it is enterprise tested and quite scalable. However it is not a Microsoft product but rather a personal OSS project I have been contributing to. Its also free.
3 Comments
Explore related questions
See similar questions with these tags.