AB#8522 - Clean up
This commit is contained in:
13
src/Umbraco.Web.BackOffice/ActionResults/JavaScriptResult.cs
Normal file
13
src/Umbraco.Web.BackOffice/ActionResults/JavaScriptResult.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Umbraco.Web.Common.ActionResults
|
||||
{
|
||||
public class JavaScriptResult : ContentResult
|
||||
{
|
||||
public JavaScriptResult(string script)
|
||||
{
|
||||
this.Content = script;
|
||||
this.ContentType = "application/javascript";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Core.Runtime;
|
||||
using Umbraco.Web.BackOffice.Filters;
|
||||
using Umbraco.Web.Common.ActionResults;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
@@ -31,21 +32,5 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
|
||||
return new JavaScriptResult(result);
|
||||
}
|
||||
|
||||
public IActionResult Reset()
|
||||
{
|
||||
_runtimeMinifier.Reset();
|
||||
|
||||
return Content("OK");
|
||||
}
|
||||
}
|
||||
|
||||
public class JavaScriptResult : ContentResult
|
||||
{
|
||||
public JavaScriptResult(string script)
|
||||
{
|
||||
this.Content = script;
|
||||
this.ContentType = "application/javascript";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Core.Assets;
|
||||
using Umbraco.Core.Runtime;
|
||||
using Umbraco.Web.BackOffice.Controllers;
|
||||
using Umbraco.Web.Common.ActionResults;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Filters
|
||||
{
|
||||
@@ -20,33 +21,15 @@ namespace Umbraco.Web.BackOffice.Filters
|
||||
|
||||
if (context.Result is JavaScriptResult jsResult)
|
||||
{
|
||||
|
||||
|
||||
var result = jsResult.Content;
|
||||
var minified = await runtimeMinifier.MinifyAsync(result, AssetType.Javascript);
|
||||
jsResult.Content = minified;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
await next(); // the actual action
|
||||
|
||||
// logic after the action goes here
|
||||
}
|
||||
|
||||
public override void OnResultExecuting(ResultExecutingContext context)
|
||||
{
|
||||
base.OnResultExecuting(context);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//minify the result
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user