From efb10fa35c186a4c7d11ba44e00aebe5603eb5c2 Mon Sep 17 00:00:00 2001 From: dean-yang <10000@ywd.me> Date: Fri, 21 Feb 2020 15:42:28 +0800 Subject: [PATCH] ExpandGlobs add prefix '/' --- src/WebOptimizer.Core/Taghelpers/LinkTagHelper.cs | 1 + src/WebOptimizer.Core/Taghelpers/ScriptTagHelper.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/WebOptimizer.Core/Taghelpers/LinkTagHelper.cs b/src/WebOptimizer.Core/Taghelpers/LinkTagHelper.cs index a657a0a..7a85279 100644 --- a/src/WebOptimizer.Core/Taghelpers/LinkTagHelper.cs +++ b/src/WebOptimizer.Core/Taghelpers/LinkTagHelper.cs @@ -83,6 +83,7 @@ private void WriteIndividualTags(TagHelperOutput output, IAsset asset) fileToAdd = Path.ChangeExtension(file, "css"); } string href = AddFileVersionToPath(fileToAdd, asset); + if (!href.StartsWith("/")) href = "/" + href; //dealing with missing prefix "/" output.PostElement.AppendHtml($"" + Environment.NewLine); } } diff --git a/src/WebOptimizer.Core/Taghelpers/ScriptTagHelper.cs b/src/WebOptimizer.Core/Taghelpers/ScriptTagHelper.cs index baa5012..904a3e3 100644 --- a/src/WebOptimizer.Core/Taghelpers/ScriptTagHelper.cs +++ b/src/WebOptimizer.Core/Taghelpers/ScriptTagHelper.cs @@ -75,6 +75,7 @@ private void WriteIndividualTags(TagHelperOutput output, IAsset asset) foreach (string file in sourceFiles) { string src = AddFileVersionToPath(file, asset); + if (!src.StartsWith("/")) src = "/" + src; //dealing with missing prefix "/" output.PostElement.AppendHtml($"" + Environment.NewLine); } }