百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

Smidge

> 前端框架
开源

一个用于 ASP.Net Core 的轻量级运行时 CSS/JavaScript 文件最小化、合并、压缩和管理库

374 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

一个用于 ASP.Net Core 的轻量级运行时 CSS/JavaScript 文件最小化、合并、压缩和管理库

Smidge

A lightweight runtime CSS/JavaScript file minification, combination, compression & management library for ASP.Net (.NET Standard)


❤️ If you use and like Smidge please consider becoming a GitHub Sponsor ❤️

News

  • 4.0.0 is out
  • 3.0.0 is out
  • 2.0.0 is out!
  • Alpha 2.0 is out!

Features

  • Minification (via NUglify), combination, compression for JS/CSS files
  • Properly configured client side caching, persistent server side caching (no rebundling unnecessarily)
  • Fluent syntax for creating and configuring bundles
  • Debug/Production configurations for each bundle
  • Cache busting - and you can customize/replace how it works
  • JS source maps (built in, powered by NUglify)
  • File watchers to auto invalidate/refresh a processed bundle
  • Extensible - you can completely customize the pre-processor pipeline and create your own processors and for any file type

Quick Start

  1. Install from Nuget:
    Install-Package Smidge
  2. Add Smidge config to appsettings.json:
    json
    "smidge": {
        "dataFolder" : "Smidge",
        "version" : "1"
      }  
  3. Add smidge to your services:
    csharp
    services.AddSmidge(Configuration.GetSection("smidge"));
  4. Create a bundle in your configure method:
    csharp
    app.UseSmidge(bundles =>
    {
       bundles.CreateJs("my-application", "~/js/site.js", "~/js/app");
    });
  5. Add the tag helpers to your _ViewImports.cshtml file:
    csharp
    @addTagHelper *, Smidge
  6. Render your bundle:
    xml
    
    

See Installation for full configuration details

Usage

Pre-defined bundles

Define your bundles during startup:

…

If you don't want to create named bundles and just want to declare dependencies individually inside your Views, you can do that too! You can create bundles (named or unnamed) during runtime ... no problem.

See Declarations for full declaration/usage details

Rendering

The easiest way to render bundles is simply by the bundle name:

xml

This uses Smidge's custom tag helpers to check if the source is a bundle reference and will output the correct bundle URL. You can combine this with environment variables for debug/non-debug modes. Alternatively, you can also use Razor to do the rendering.

See Rendering for full rendering & debug mode details

Custom pre-processing pipeline

It's easy to customize how your files are processed including the way files are minified, how URLs are resolved, etc.... This can be done at a global/default level, at the bundle level or at an individual file level.

See Custom Pre-Processing Pipeline for information about customizing the pre-process pipeline

URLs

There's a couple of methods you can use to retrieve the URLs that Smidge will generate when rendering the or html tags. This might be handy in case you need to load in these assets manually (i.e. lazy load scripts, etc...):

csharp
Task> SmidgeHelper.GenerateJsUrlsAsync()
Task> SmidgeHelper.GenerateCssUrlsAsync()

See Asset URLs for information about retrieving the debug and non-debug asset urls for your bundles

Documentation

All of the documentation lives here

I haven't had time to document all of the features and extensibility points just yet but I'm working on it :)

Copyright & Licence

© 2021 by Shannon Deminick

This is free software and is licensed under the MIT License

Logo image Designed by Freepik

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#asp-net-corecompressioncsshactoberfest

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架