Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified HTML Output #142

Merged
merged 1 commit into from
Apr 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/Smidge/SmidgeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public async Task<HtmlString> JsHereAsync(string bundleName, bool debug = false)

foreach (var url in urls)
{
result.AppendFormat("<script src='{0}' type='text/javascript'></script>", url);
result.AppendFormat("<script src=\"{0}\"></script>", url);
}
return new HtmlString(result.ToString());
}
Expand All @@ -90,7 +90,7 @@ public async Task<HtmlString> CssHereAsync(string bundleName, bool debug = false

foreach (var url in urls)
{
result.AppendFormat("<link href='{0}' rel='stylesheet' type='text/css'/>", url);
result.AppendFormat("<link href=\"{0}\" rel=\"stylesheet\">", url);
}
return new HtmlString(result.ToString());
}
Expand All @@ -100,7 +100,7 @@ public async Task<HtmlString> CssHereAsync(string bundleName, bool debug = false
/// </summary>
/// <returns></returns>
/// <remarks>
/// TODO: Once the tags are rendered the collection on the context is cleared. Therefore if this method is called multiple times it will
/// TODO: Once the tags are rendered the collection on the context is cleared. Therefore if this method is called multiple times it will
/// render anything that has been registered as 'pending' but has not been rendered.
/// </remarks>
public async Task<HtmlString> JsHereAsync(PreProcessPipeline pipeline = null, bool debug = false)
Expand All @@ -109,7 +109,7 @@ public async Task<HtmlString> JsHereAsync(PreProcessPipeline pipeline = null, bo
var urls = await GenerateJsUrlsAsync(pipeline, debug);
foreach (var url in urls)
{
result.AppendFormat("<script src='{0}' type='text/javascript'></script>", url);
result.AppendFormat("<script src=\"{0}\"></script>", url);
}
return new HtmlString(result.ToString());
}
Expand All @@ -119,7 +119,7 @@ public async Task<HtmlString> JsHereAsync(PreProcessPipeline pipeline = null, bo
/// </summary>
/// <returns></returns>
/// <remarks>
/// TODO: Once the tags are rendered the collection on the context is cleared. Therefore if this method is called multiple times it will
/// TODO: Once the tags are rendered the collection on the context is cleared. Therefore if this method is called multiple times it will
/// render anything that has been registered as 'pending' but has not been rendered.
/// </remarks>
public async Task<HtmlString> CssHereAsync(PreProcessPipeline pipeline = null, bool debug = false)
Expand All @@ -128,7 +128,7 @@ public async Task<HtmlString> CssHereAsync(PreProcessPipeline pipeline = null, b
var urls = await GenerateCssUrlsAsync(pipeline, debug);
foreach (var url in urls)
{
result.AppendFormat("<link href='{0}' rel='stylesheet' type='text/css'/>", url);
Shazwazza marked this conversation as resolved.
Show resolved Hide resolved
result.AppendFormat("<link href=\"{0}\" rel=\"stylesheet\">", url);
}
return new HtmlString(result.ToString());
}
Expand Down Expand Up @@ -192,8 +192,8 @@ private IEnumerable<string> GenerateBundleUrlsAsync(string bundleName, string fi

//if not processing as composite files, then just use their native file paths
if (!bundleOptions.ProcessAsCompositeFile)
{
var files = _fileSetGenerator.GetOrderedFileSet(bundle,
{
var files = _fileSetGenerator.GetOrderedFileSet(bundle,
_processorFactory.CreateDefault(
//the file type in the bundle will always be the same
bundle.Files[0].DependencyType));
Expand Down Expand Up @@ -225,7 +225,7 @@ private async Task<IEnumerable<string>> GenerateUrlsAsync(
bool debug = false)
{
var result = new List<string>();

var orderedFiles = _fileSetGenerator.GetOrderedFileSet(files, pipeline ?? _processorFactory.CreateDefault(fileType));

var cacheBuster = _cacheBusterResolver.GetCacheBuster(_bundleManager.GetDefaultBundleOptions(debug).GetCacheBusterType());
Expand All @@ -237,7 +237,7 @@ private async Task<IEnumerable<string>> GenerateUrlsAsync(
}

var compression = _requestHelper.GetClientCompression(_httpContextAccessor.HttpContext.Request.Headers);

//Get the file collection used to create the composite URLs and the external requests
var fileBatches = _fileBatcher.GetCompositeFileCollectionForUrlGeneration(orderedFiles);

Expand All @@ -254,7 +254,7 @@ private async Task<IEnumerable<string>> GenerateUrlsAsync(
//Get the URLs for the batch, this could be more than one resulting URL depending on how many
// files are in the batch and the max url length
var compositeUrls = _urlManager.GetUrls(
batch.Select(x => x.Hashed),
batch.Select(x => x.Hashed),
fileType == WebFileType.Css ? ".css" : ".js",
cacheBusterValue);

Expand Down Expand Up @@ -349,4 +349,4 @@ public ISmidgeRequire CreateCssBundle(string bundleName)
return new SmidgeRequire(bundleName, _bundleManager, WebFileType.Css, _requestHelper);
}
}
}
}