一个用于 ASP.Net Core 的轻量级运行时 CSS/JavaScript 文件最小化、合并、压缩和管理库
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 ❤️
Install-Package Smidge"smidge": {
"dataFolder" : "Smidge",
"version" : "1"
} services.AddSmidge(Configuration.GetSection("smidge"));app.UseSmidge(bundles =>
{
bundles.CreateJs("my-application", "~/js/site.js", "~/js/app");
});@addTagHelper *, Smidge
See Installation for full configuration details
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
The easiest way to render bundles is simply by the bundle name:
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
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
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...):
Task> SmidgeHelper.GenerateJsUrlsAsync()
Task> SmidgeHelper.GenerateCssUrlsAsync()See Asset URLs for information about retrieving the debug and non-debug asset urls for your bundles
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 :)
© 2021 by Shannon Deminick
This is free software and is licensed under the MIT License
Logo image Designed by Freepik
暂无开放 Issues,或尚未同步最近议题。