Browse Source

Add version query string parameter to the bundle items.

pull/301/head
Halil ibrahim Kalkan 8 years ago
parent
commit
7d371f2462
  1. 13
      src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperServiceBase.cs
  2. 9
      src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpScriptBundleTagHelperService.cs
  3. 9
      src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpStyleBundleTagHelperService.cs

13
src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperServiceBase.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers;
using Volo.Abp.AspNetCore.VirtualFileSystem;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{
@ -10,10 +11,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
where TTagHelper : TagHelper, IBundleTagHelper
{
protected IBundleManager BundleManager { get; }
protected IHybridWebRootFileProvider WebRootFileProvider { get; }
protected AbpBundleTagHelperServiceBase(IBundleManager bundleManager)
protected AbpBundleTagHelperServiceBase(IBundleManager bundleManager, IHybridWebRootFileProvider webRootFileProvider)
{
BundleManager = bundleManager;
WebRootFileProvider = webRootFileProvider;
}
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
@ -35,7 +38,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
foreach (var bundleFile in bundleFiles)
{
AddHtmlTag(context, output, bundleFile + "_");
var file = WebRootFileProvider.GetFileInfo(bundleFile);
if (file == null)
{
throw new AbpException($"Could not find the bundle file from {nameof(IHybridWebRootFileProvider)}");
}
AddHtmlTag(context, output, bundleFile + "?_v=" + file.LastModified.UtcTicks);
}
}

9
src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpScriptBundleTagHelperService.cs

@ -1,13 +1,18 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Abp.AspNetCore.VirtualFileSystem;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{
public class AbpScriptBundleTagHelperService : AbpBundleTagHelperServiceBase<AbpScriptBundleTagHelper>
{
public AbpScriptBundleTagHelperService(IBundleManager bundleManager)
: base(bundleManager)
public AbpScriptBundleTagHelperService(
IBundleManager bundleManager,
IHybridWebRootFileProvider webRootFileProvider)
: base(
bundleManager,
webRootFileProvider)
{
}

9
src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpStyleBundleTagHelperService.cs

@ -1,13 +1,18 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Abp.AspNetCore.VirtualFileSystem;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{
public class AbpStyleBundleTagHelperService : AbpBundleTagHelperServiceBase<AbpStyleBundleTagHelper>
{
public AbpStyleBundleTagHelperService(IBundleManager bundleManager)
: base(bundleManager)
public AbpStyleBundleTagHelperService(
IBundleManager bundleManager,
IHybridWebRootFileProvider webRootFileProvider)
: base(
bundleManager,
webRootFileProvider)
{
}

Loading…
Cancel
Save