Umbraco.Community.Smidge 1.0.0

dotnet add package Umbraco.Community.Smidge --version 1.0.0
                    
NuGet\Install-Package Umbraco.Community.Smidge -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Umbraco.Community.Smidge" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Umbraco.Community.Smidge" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Umbraco.Community.Smidge" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Umbraco.Community.Smidge --version 1.0.0
                    
#r "nuget: Umbraco.Community.Smidge, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Umbraco.Community.Smidge@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Umbraco.Community.Smidge&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Umbraco.Community.Smidge&version=1.0.0
                    
Install as a Cake Tool

Umbraco.Community.Smidge

Overview

This project restores the RuntimeMinifier functionality to Umbraco v16.1.1+, powered by Smidge. The RuntimeMinifier was removed in Umbraco v14, and this package reintroduces it for developers who need runtime minification of CSS and JavaScript assets.

Features

  • Runtime minification of CSS and JavaScript using Smidge
  • Easy integration with Umbraco v16.1.1+
  • Configuration options for bundling and cache busting

Installation

  1. Add the NuGet package to your Umbraco project:
    dotnet add package Umbraco.Community.Smidge
    
  2. Ensure your project is running Umbraco v16.1.1 or later.

Usage

  1. Add .AddRuntimeMinifier() to your UmbracoBuilder:

    // In your Startup or Program.cs
     builder.CreateUmbracoBuilder()
     .AddBackOffice()
     .AddWebsite()
     .AddComposers()
     .AddSlimsy()
     .AddRuntimeMinifier()
     .Build();
    
  2. Use the IRuntimeMinifier interface to minify assets at runtime.

Example
// Example usage in a notification handler
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Community.Smidge;

public class CreateBundlesNotificationHandler : INotificationHandler<UmbracoApplicationStartingNotification>
{
    private readonly IRuntimeMinifier _runtimeMinifier;
    private readonly IRuntimeState _runtimeState;

    public CreateBundlesNotificationHandler(IRuntimeMinifier runtimeMinifier, IRuntimeState runtimeState)
    {
        _runtimeMinifier = runtimeMinifier;
        _runtimeState = runtimeState;
    }
    public void Handle(UmbracoApplicationStartingNotification notification)
    {
        if (_runtimeState.Level == RuntimeLevel.Run)
        {
            _runtimeMinifier.CreateJsBundle("core-javascript-bundle",
                BundlingOptions.OptimizedNotComposite,
                ["~/scripts/main.min.js"]);

            _runtimeMinifier.CreateCssBundle("core-style-bundle",
                BundlingOptions.OptimizedNotComposite,
                ["~/css/bootstrap.min.css", "~/css/main.min.css"]);
        }
    }
}

Configuration

  • You can customize bundling and cache busting via the provided options classes (BundlingOptions, RuntimeMinificationSettings, etc.).
  • Refer to the source files for advanced configuration.

Contributing

Contributions are welcome! Please submit issues or pull requests via GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Credits

  • Smidge by Shannon Deminick
  • Umbraco Community

For more information, see the source code and comments in this repository.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 96 7/30/2025