I use it in V7, so only simple changes need to be made:
namespace Umbraco.Community.Web
{
public class UpdateHtmlExampleComposer : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ClientDependencySettings.Instance.ConfigSection.Filters
.Add(new ProviderSettings(nameof(UpdateHtmlExampleFilter), typeof(UpdateHtmlExampleFilter).GetFullNameWithAssembly()));
}
}
public class UpdateHtmlExampleFilter : IFilter
{
public HttpContextBase CurrentContext { get; private set; }
public bool CanExecute()
{
return Umbraco.Web.UmbracoContext.Current?.IsFrontEndUmbracoRequest == true;
}
public void SetHttpContext(HttpContextBase ctx) => CurrentContext = ctx;
public string UpdateOutputHtml(string html)
{
// TODO: Do your HTML updates in here!
// ------------------------------------
// o o/ o o/ o o/
// //| /| //| /| //| /|
// / \ / \ / \ / \ / \ / \
// ------------------------------------
So far, so good. I buid a dll and it works fine in a lot of webs, except the one now - a customer of my uses the MVC-UniBase Concept and in the Partial-View, there are two lines of code, that leads to an error:
This two lines, that will usually output a compressed Version of a bundle of js and css files, now just output this after running through my rendering-Code:
Using ClientDependency Filters to manipulate HTML
Hi,
I want to manipulate the html-code before it gets send back to the client - in my case, I want to replace all e-Mail addresses with a certain javascript-Code. Anyway, it works well with the cool code-snippet of Lee Kelleher, found here for V8: https://leekelleher.com/2020/01/clientdependency-filters-manipulate-html/?fbclid=IwAR2NCF6B-qaD8Srq1ULea0ZsT-360jI7bQUevbMGrfA2eABo3hkQkWVwYac
I use it in V7, so only simple changes need to be made:
So far, so good. I buid a dll and it works fine in a lot of webs, except the one now - a customer of my uses the MVC-UniBase Concept and in the Partial-View, there are two lines of code, that leads to an error:
This two lines, that will usually output a compressed Version of a bundle of js and css files, now just output this after running through my rendering-Code:
Expected should be this:
Any idea how to fix this?
Hi @Thomas Becket,
I have the same issue with V8, so it is not specific to V7.
Any luck yet on finding a solution?
Cheers,
Ruben
Unfortunately so far not.
Using SquishIT Compressor works: https://www.simplethread.com/squishit-the-friendly-aspnet-javascript-and-css-squisher/
This could be an alternative.
is working on a reply...