AB#5822 - Small changes

This commit is contained in:
Bjarke Berg
2020-04-03 10:04:43 +02:00
parent d711796c59
commit 440ebf6f18
3 changed files with 27 additions and 18 deletions
@@ -67,8 +67,17 @@ namespace Umbraco.Core.WebAssets
/// </returns>
Task<IEnumerable<string>> GetAssetPathsAsync(string bundleName);
/// <summary>
/// Minify the file content, of a given type
/// </summary>
/// <param name="fileContent"></param>
/// <param name="assetType"></param>
/// <returns></returns>
Task<string> MinifyAsync(string fileContent, AssetType assetType);
/// <summary>
/// Ensures that all runtime minifications are refreshed on next request. E.g. Clearing cache.
/// </summary>
void Reset();
}
@@ -19,7 +19,7 @@ namespace Umbraco.Tests.Integration.Testing
/// <summary>
/// Manages a pool of LocalDb databases for integration testing
/// </summary>
public class LocalDbTestDatabase
public class LocalDbTestDatabase
{
public const string InstanceName = "UmbracoTests";
public const string DatabaseName = "UmbracoTests";
@@ -137,7 +137,7 @@ namespace Umbraco.Tests.Integration.Testing
_dbCommands = database.Commands.ToArray();
}
}
private static void AddParameter(IDbCommand cmd, UmbracoDatabase.ParameterInfo parameterInfo)
@@ -199,7 +199,7 @@ namespace Umbraco.Tests.Integration.Testing
cmd.ExecuteNonQuery();
return;
}
catch (SqlException ex)
catch (SqlException)
{
// This can occur when there's a transaction deadlock which means (i think) that the database is still in use and hasn't been closed properly yet
// so we need to just wait a little bit
@@ -208,7 +208,7 @@ namespace Umbraco.Tests.Integration.Testing
throw;
}
}
}
public static void KillLocalDb()
@@ -49,7 +49,7 @@ namespace Umbraco.Web.Common.RuntimeMinification
public string CacheBuster => _smidgeConfig.Version;
// only issue with creating bundles like this is that we don't have full control over the bundle options, though that could
// only issue with creating bundles like this is that we don't have full control over the bundle options, though that could
public void CreateCssBundle(string bundleName, params string[] filePaths)
{
if (filePaths.Any(f => !f.StartsWith("/") && !f.StartsWith("~/")))
@@ -63,7 +63,7 @@ namespace Umbraco.Web.Common.RuntimeMinification
// Here we could configure bundle options instead of using smidge's global defaults.
// For example we can use our own custom cache buster for this bundle without having the global one
// affect this or vice versa.
}
}
public string RenderCssHere(string bundleName) => _smidge.SmidgeHelper.CssHereAsync(bundleName, _hostingEnvironment.IsDebugMode).ToString();
@@ -86,25 +86,25 @@ namespace Umbraco.Web.Common.RuntimeMinification
public async Task<IEnumerable<string>> GetAssetPathsAsync(string bundleName) => await _smidge.SmidgeHelper.GenerateJsUrlsAsync(bundleName, _hostingEnvironment.IsDebugMode);
/// <inheritdoc />
public async Task<string> MinifyAsync(string fileContent, AssetType assetType)
{
if (assetType == AssetType.Javascript)
switch (assetType)
{
return await JsPipeline
.ProcessAsync(
new FileProcessContext(fileContent, new JavaScriptFile(), BundleContext.CreateEmpty()));
}
else
{
return await CssPipeline
.ProcessAsync(new FileProcessContext(fileContent, new CssFile(), BundleContext.CreateEmpty()));
case AssetType.Javascript:
return await JsPipeline
.ProcessAsync(
new FileProcessContext(fileContent, new JavaScriptFile(), BundleContext.CreateEmpty()));
case AssetType.Css:
return await CssPipeline
.ProcessAsync(new FileProcessContext(fileContent, new CssFile(), BundleContext.CreateEmpty()));
default:
throw new NotSupportedException("Unexpected AssetType");
}
}
/// <summary>
///
/// </summary>
/// <inheritdoc />
/// <remarks>
/// Smidge uses the version number as cache buster (configurable).
/// We therefore can reset, by updating the version number in config