diff --git a/NuGet.Config b/NuGet.Config
index 64425091dc..d6c63173f8 100644
--- a/NuGet.Config
+++ b/NuGet.Config
@@ -8,5 +8,6 @@
+
diff --git a/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs b/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs
index 414165d2e4..9667a5eb2d 100644
--- a/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs
@@ -7,6 +7,7 @@ namespace Umbraco.Core.Configuration.Models
///
public class ModelsBuilderSettings
{
+ // TODO: This should not go into App_Data - that folder isn't really a real thing anymore
public static string DefaultModelsDirectory => "~/App_Data/Models";
///
diff --git a/src/Umbraco.Web.Common/Extensions/ApplicationBuilderExtensions.cs b/src/Umbraco.Web.Common/Extensions/ApplicationBuilderExtensions.cs
index dcc9bbca70..2415b4e924 100644
--- a/src/Umbraco.Web.Common/Extensions/ApplicationBuilderExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/ApplicationBuilderExtensions.cs
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Serilog.Context;
using Smidge;
+using Smidge.Nuglify;
using StackExchange.Profiling;
using Umbraco.Core;
using Umbraco.Core.Hosting;
@@ -110,6 +111,7 @@ namespace Umbraco.Extensions
if (!app.UmbracoCanBoot()) return app;
app.UseSmidge();
+ app.UseSmidgeNuglify();
return app;
}
diff --git a/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs b/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
index 8993699db0..f91fdceb4f 100644
--- a/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
@@ -304,13 +304,6 @@ namespace Umbraco.Extensions
factory = coreRuntime.Configure(container);
-
- services.Configure(hostingSettings =>
- {
- hostingSettings.Debug = false;
- });
-
-
return services;
}
diff --git a/src/Umbraco.Web.Common/Extensions/UmbracoWebServiceCollectionExtensions.cs b/src/Umbraco.Web.Common/Extensions/UmbracoWebServiceCollectionExtensions.cs
index e37b6f81fd..37ac5c7683 100644
--- a/src/Umbraco.Web.Common/Extensions/UmbracoWebServiceCollectionExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/UmbracoWebServiceCollectionExtensions.cs
@@ -1,14 +1,10 @@
-using System.Buffers;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Web.Caching;
@@ -18,12 +14,8 @@ using SixLabors.ImageSharp.Web.Processors;
using SixLabors.ImageSharp.Web.Providers;
using Smidge;
using Smidge.Nuglify;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Web.Common.ApplicationModels;
-using Umbraco.Web.Common.Middleware;
-using Umbraco.Web.Common.ModelBinding;
namespace Umbraco.Extensions
{
diff --git a/src/Umbraco.Web.Common/RuntimeMinification/SmidgeComposer.cs b/src/Umbraco.Web.Common/RuntimeMinification/SmidgeComposer.cs
index 6046f9eee6..0cb7bc71d2 100644
--- a/src/Umbraco.Web.Common/RuntimeMinification/SmidgeComposer.cs
+++ b/src/Umbraco.Web.Common/RuntimeMinification/SmidgeComposer.cs
@@ -1,4 +1,5 @@
-using Umbraco.Core;
+using Smidge.FileProcessors;
+using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Runtime;
using Umbraco.Core.WebAssets;
@@ -16,6 +17,7 @@ namespace Umbraco.Web.Common.RuntimeMinification
composition.RegisterUnique();
composition.RegisterUnique();
+ composition.Register();
}
}
}
diff --git a/src/Umbraco.Web.Common/RuntimeMinification/SmidgeNuglifyJs.cs b/src/Umbraco.Web.Common/RuntimeMinification/SmidgeNuglifyJs.cs
new file mode 100644
index 0000000000..bab4abde53
--- /dev/null
+++ b/src/Umbraco.Web.Common/RuntimeMinification/SmidgeNuglifyJs.cs
@@ -0,0 +1,28 @@
+using Smidge.Nuglify;
+
+namespace Umbraco.Web.Common.RuntimeMinification
+{
+ ///
+ /// Custom Nuglify Js pre-process to specify custom nuglify options without changing the global defaults
+ ///
+ public class SmidgeNuglifyJs : NuglifyJs
+ {
+ public SmidgeNuglifyJs(NuglifySettings settings, ISourceMapDeclaration sourceMapDeclaration)
+ : base(GetSettings(settings), sourceMapDeclaration)
+ {
+ }
+
+ private static NuglifySettings GetSettings(NuglifySettings defaultSettings)
+ {
+ var nuglifyCodeSettings = defaultSettings.JsCodeSettings.CodeSettings.Clone();
+
+ // Don't rename locals, this will kill a lot of angular stuff because we aren't correctly coding our
+ // angular injection to handle minification correctly which requires declaring string named versions of all
+ // dependencies injected (which is a pain). So we just turn this option off.
+ nuglifyCodeSettings.LocalRenaming = NUglify.JavaScript.LocalRenaming.KeepAll;
+ nuglifyCodeSettings.PreserveFunctionNames = true;
+
+ return new NuglifySettings(new NuglifyCodeSettings(nuglifyCodeSettings), defaultSettings.CssCodeSettings);
+ }
+ }
+}
diff --git a/src/Umbraco.Web.Common/RuntimeMinification/SmidgeRuntimeMinifier.cs b/src/Umbraco.Web.Common/RuntimeMinification/SmidgeRuntimeMinifier.cs
index a33ac6f966..29a0e41998 100644
--- a/src/Umbraco.Web.Common/RuntimeMinification/SmidgeRuntimeMinifier.cs
+++ b/src/Umbraco.Web.Common/RuntimeMinification/SmidgeRuntimeMinifier.cs
@@ -21,31 +21,39 @@ namespace Umbraco.Web.Common.RuntimeMinification
private readonly IHostingEnvironment _hostingEnvironment;
private readonly ISmidgeConfig _smidgeConfig;
private readonly IConfigManipulator _configManipulator;
- private readonly PreProcessPipelineFactory _preProcessPipelineFactory;
private readonly IBundleManager _bundles;
private readonly SmidgeHelperAccessor _smidge;
- private PreProcessPipeline _jsPipeline;
- private PreProcessPipeline _cssPipeline;
+ // used only for minifying in MinifyAsync not for an actual pipeline
+ private Lazy _jsMinPipeline;
+ private Lazy _cssMinPipeline;
+
+ // default pipelines for processing js/css files for the back office
+ private Lazy _jsPipeline;
+ private Lazy _cssPipeline;
public SmidgeRuntimeMinifier(
IBundleManager bundles,
SmidgeHelperAccessor smidge,
- PreProcessPipelineFactory preProcessPipelineFactory,
IHostingEnvironment hostingEnvironment,
ISmidgeConfig smidgeConfig,
IConfigManipulator configManipulator)
{
_bundles = bundles;
_smidge = smidge;
- _preProcessPipelineFactory = preProcessPipelineFactory;
_hostingEnvironment = hostingEnvironment;
_smidgeConfig = smidgeConfig;
_configManipulator = configManipulator;
- }
- private PreProcessPipeline JsPipeline => _jsPipeline ??= _preProcessPipelineFactory.Create(typeof(JsMinifier));
- private PreProcessPipeline CssPipeline => _cssPipeline ??= _preProcessPipelineFactory.Create(typeof(NuglifyCss));
+ _jsMinPipeline = new Lazy(() => _bundles.PipelineFactory.Create(typeof(JsMinifier)));
+ _cssMinPipeline = new Lazy(() => _bundles.PipelineFactory.Create(typeof(NuglifyCss)));
+
+ // replace the default JsMinifier with NuglifyJs and CssMinifier with NuglifyCss in the default pipelines
+ // for use with our bundles only (not modifying global options)
+ _jsPipeline = new Lazy(() => bundles.PipelineFactory.DefaultJs().Replace(_bundles.PipelineFactory));
+ _cssPipeline = new Lazy(() => bundles.PipelineFactory.DefaultCss().Replace(_bundles.PipelineFactory));
+
+ }
public string CacheBuster => _smidgeConfig.Version;
@@ -58,11 +66,10 @@ namespace Umbraco.Web.Common.RuntimeMinification
if (_bundles.Exists(bundleName))
throw new InvalidOperationException($"The bundle name {bundleName} already exists");
- var bundle = _bundles.Create(bundleName, WebFileType.Css, filePaths);
-
// 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.
+ var bundle = _bundles.Create(bundleName, _cssPipeline.Value, WebFileType.Css, filePaths);
}
public async Task RenderCssHereAsync(string bundleName) => (await _smidge.SmidgeHelper.CssHereAsync(bundleName, _hostingEnvironment.IsDebugMode)).ToString();
@@ -75,11 +82,10 @@ namespace Umbraco.Web.Common.RuntimeMinification
if (_bundles.Exists(bundleName))
throw new InvalidOperationException($"The bundle name {bundleName} already exists");
- var bundle = _bundles.Create(bundleName, WebFileType.Js, filePaths);
-
// 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.
+ var bundle = _bundles.Create(bundleName, _jsPipeline.Value, WebFileType.Js, filePaths);
}
public async Task RenderJsHereAsync(string bundleName) => (await _smidge.SmidgeHelper.JsHereAsync(bundleName, _hostingEnvironment.IsDebugMode)).ToString();
@@ -92,11 +98,11 @@ namespace Umbraco.Web.Common.RuntimeMinification
switch (assetType)
{
case AssetType.Javascript:
- return await JsPipeline
+ return await _jsMinPipeline.Value
.ProcessAsync(
new FileProcessContext(fileContent, new JavaScriptFile(), BundleContext.CreateEmpty()));
case AssetType.Css:
- return await CssPipeline
+ return await _cssMinPipeline.Value
.ProcessAsync(new FileProcessContext(fileContent, new CssFile(), BundleContext.CreateEmpty()));
default:
throw new NotSupportedException("Unexpected AssetType");
diff --git a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj
index 421621e668..a712a43a45 100644
--- a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj
+++ b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj
@@ -26,8 +26,8 @@
-
-
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js
index 6d41ea087d..ed0a1c602c 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js
@@ -370,7 +370,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt
//This is the ideal button order but depends on circumstance, we'll use this array to create the button list
// Publish, SendToPublish, Save
var actionOrder = ["U", "H", "A"];
- var defaultActions;
+ var defaultAction = null;
var actions = [];
//Create the first button (primary button)
diff --git a/src/Umbraco.Web.UI.NetCore/appsettings.json b/src/Umbraco.Web.UI.NetCore/appsettings.json
index 70e3d6376d..0d068bbd43 100644
--- a/src/Umbraco.Web.UI.NetCore/appsettings.json
+++ b/src/Umbraco.Web.UI.NetCore/appsettings.json
@@ -38,7 +38,7 @@
"ConvertUrlsToAscii": "try"
},
"RuntimeMinification": {
- "dataFolder": "App_Data\\Smidge",
+ "dataFolder": "App_Data/TEMP/Smidge",
"version": "1"
},
"Security": {