diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs
index ffc312a43e..5edd70d164 100644
--- a/src/Umbraco.Web/Editors/BackOfficeController.cs
+++ b/src/Umbraco.Web/Editors/BackOfficeController.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Mvc;
+using System.Web.UI;
using Newtonsoft.Json.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
@@ -59,6 +60,8 @@ namespace Umbraco.Web.Editors
/// Returns the JavaScript object representing the static server variables javascript object
///
///
+ [MinifyJavaScriptResult(Order = 0)]
+ [OutputCache(Order = 1, VaryByParam = "none", Location = OutputCacheLocation.Any, Duration = 5000)]
public JavaScriptResult ServerVariables()
{
//now we need to build up the variables
diff --git a/src/Umbraco.Web/Mvc/MinifyJavaScriptResultAttribute.cs b/src/Umbraco.Web/Mvc/MinifyJavaScriptResultAttribute.cs
new file mode 100644
index 0000000000..498c6acc76
--- /dev/null
+++ b/src/Umbraco.Web/Mvc/MinifyJavaScriptResultAttribute.cs
@@ -0,0 +1,38 @@
+using System.Web;
+using System.Web.Mvc;
+using System.Web.UI;
+using ClientDependency.Core;
+using ClientDependency.Core.CompositeFiles;
+
+namespace Umbraco.Web.Mvc
+{
+ ///
+ /// Minifies and caches the result for the JavaScriptResult
+ ///
+ ///
+ /// Only minifies in release mode
+ ///
+ public class MinifyJavaScriptResultAttribute : ActionFilterAttribute
+ {
+ ///
+ /// Minify the result if in release mode
+ ///
+ ///
+ public override void OnResultExecuting(ResultExecutingContext filterContext)
+ {
+ base.OnResultExecuting(filterContext);
+
+ if (filterContext.Result == null) return;
+ var jsResult = filterContext.Result as JavaScriptResult;
+ if (jsResult == null) return;
+ if (filterContext.HttpContext.IsDebuggingEnabled) return;
+
+ //minify the result
+ var result = jsResult.Script;
+ var minifier = new JSMin();
+ var minified = minifier.Minify(result);
+ jsResult.Script = minified;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index ae2aed1ae0..bc480fa4f8 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -312,6 +312,7 @@
+