|
|
|
@ -5,6 +5,8 @@ using System.Collections.Generic;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
@ -20,7 +22,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
|
|
|
|
protected IWebContentFileProvider WebContentFileProvider { get; }
|
|
|
|
protected IWebContentFileProvider WebContentFileProvider { get; }
|
|
|
|
protected IWebHostEnvironment HostingEnvironment { get; }
|
|
|
|
protected IWebHostEnvironment HostingEnvironment { get; }
|
|
|
|
protected readonly AbpBundlingOptions Options;
|
|
|
|
protected readonly AbpBundlingOptions Options;
|
|
|
|
|
|
|
|
|
|
|
|
protected AbpTagHelperResourceService(
|
|
|
|
protected AbpTagHelperResourceService(
|
|
|
|
IBundleManager bundleManager,
|
|
|
|
IBundleManager bundleManager,
|
|
|
|
IWebContentFileProvider webContentFileProvider,
|
|
|
|
IWebContentFileProvider webContentFileProvider,
|
|
|
|
@ -36,11 +38,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual async Task ProcessAsync(
|
|
|
|
public virtual async Task ProcessAsync(
|
|
|
|
|
|
|
|
[NotNull] ViewContext viewContext,
|
|
|
|
[NotNull] TagHelperContext context,
|
|
|
|
[NotNull] TagHelperContext context,
|
|
|
|
[NotNull] TagHelperOutput output,
|
|
|
|
[NotNull] TagHelperOutput output,
|
|
|
|
[NotNull] List<BundleTagHelperItem> bundleItems,
|
|
|
|
[NotNull] List<BundleTagHelperItem> bundleItems,
|
|
|
|
[CanBeNull] string bundleName = null)
|
|
|
|
[CanBeNull] string bundleName = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
Check.NotNull(viewContext, nameof(viewContext));
|
|
|
|
Check.NotNull(context, nameof(context));
|
|
|
|
Check.NotNull(context, nameof(context));
|
|
|
|
Check.NotNull(output, nameof(output));
|
|
|
|
Check.NotNull(output, nameof(output));
|
|
|
|
Check.NotNull(bundleItems, nameof(bundleItems));
|
|
|
|
Check.NotNull(bundleItems, nameof(bundleItems));
|
|
|
|
@ -69,7 +73,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
|
|
|
|
throw new AbpException($"Could not find the bundle file '{bundleFile}' from {nameof(IWebContentFileProvider)}");
|
|
|
|
throw new AbpException($"Could not find the bundle file '{bundleFile}' from {nameof(IWebContentFileProvider)}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AddHtmlTag(context, output, bundleFile + "?_v=" + file.LastModified.UtcTicks);
|
|
|
|
AddHtmlTag(viewContext, context, output, bundleFile + "?_v=" + file.LastModified.UtcTicks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
stopwatch.Stop();
|
|
|
|
@ -80,11 +84,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
|
|
|
|
|
|
|
|
|
|
|
|
protected abstract Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName);
|
|
|
|
protected abstract Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName);
|
|
|
|
|
|
|
|
|
|
|
|
protected abstract void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file);
|
|
|
|
protected abstract void AddHtmlTag(ViewContext viewContext, TagHelperContext context, TagHelperOutput output, string file);
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual string GenerateBundleName(List<BundleTagHelperItem> bundleItems)
|
|
|
|
protected virtual string GenerateBundleName(List<BundleTagHelperItem> bundleItems)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return bundleItems.JoinAsString("|").ToMd5();
|
|
|
|
return bundleItems.JoinAsString("|").ToMd5();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|