LayerZero.Tools.Web 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LayerZero.Tools.Web --version 1.0.1
                    
NuGet\Install-Package LayerZero.Tools.Web -Version 1.0.1
                    
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="LayerZero.Tools.Web" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LayerZero.Tools.Web" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="LayerZero.Tools.Web" />
                    
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 LayerZero.Tools.Web --version 1.0.1
                    
#r "nuget: LayerZero.Tools.Web, 1.0.1"
                    
#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 LayerZero.Tools.Web@1.0.1
                    
#: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=LayerZero.Tools.Web&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=LayerZero.Tools.Web&version=1.0.1
                    
Install as a Cake Tool

📦 LayerZero.Tools.Web – Dynamic Bundle Loader for ASP.NET Core

A convention-based asset bundling system for .NET 8+ using WebOptimizer. Automatically discovers and injects CSS/JS bundles per controller and action using lightweight Razor TagHelpers.

🔍 Purpose

Eliminate manual asset registration by scanning your folder structure and generating optimized bundles dynamically — the right CSS and JS are served per-controller or action, automatically.


🆕 v1.0.1 Highlights

✅ Added

  • Conditional Minification
    Unminified bundles in Development (IWebHostEnvironment.IsDevelopment()), minified in Production.

  • SpindleTreeGuard
    Prevents bundle generation from empty directories using file extension filters like .js and .css.

🔧 Changed

  • Refactored Register() Method
    Improved clarity, readability, and better conditional logic for dev/prod handling.

  • Cross-Platform Pathing
    Normalized directory paths using / separators for Windows/Linux compatibility.

🛠️ Technical

  • Enforced stricter checks to avoid creating unnecessary or empty bundles.
  • Reduced noise in dev builds and improved maintainability.

📁 Folder Convention

wwwroot/
├── js/
│   └── controllers/
│       ├── Home/
│       │   ├── index/
│       │   │      ├── tool.js
│       │   │      └── action.js
│       │   └── home.js
│       └── Dashboard/
│           └── overview.js
└── css/
    └── controllers/
        ├── Home/
        │   ├── HomeLayout.css
        │   └── shared.css
        └── Dashboard/
            └── overview.css

Your folder structure determines which bundles are auto-generated.


⚙️ Installation

Install via NuGet:

dotnet add package LayerZero.Tools.Web

Add to Program.cs:

builder.Services.AddSingleton(DynamicBundleMapper.Bundles);
builder.Services.AddWebOptimizer(pipeline =>
{
    DynamicBundleMapper.Register(pipeline);
});

Then in Startup.cs or Program:

app.UseWebOptimizer();

✨ Features

  • ✅ Convention-over-configuration
  • ✅ Conditional minification (Dev vs Prod)
  • ✅ Auto-detects bundles per controller/action
  • ✅ Razor TagHelpers for layout injection
  • ✅ Clean fallback for empty or missing files
  • ✅ Cross-platform path support

🧠 TagHelpers

Add to _ViewImports.cshtml:

@addTagHelper *, LayerZero.Tools.Web

In _Layout.cshtml:

<head>
    <style-bundle-loader />
</head>
<body>
    @RenderBody()
    <script-bundle-loader />
</body>
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.3.0 86 7/5/2025
1.2.0 71 6/28/2025
1.1.1 111 6/22/2025
1.1.0 107 6/22/2025
1.0.1 196 6/13/2025
1.0.0 291 6/11/2025