All Projects → Shazwazza → Smidge

Shazwazza / Smidge

Licence: mit
A lightweight runtime CSS/JavaScript file minification, combination, compression & management library for ASP.Net Core

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Smidge

packtag
A JSP Taglib for delivering minified, combined and gzip-compressed resources (JavaScript and CSS).
Stars: ✭ 22 (-91.76%)
Mutual labels:  compression, minification
Lib.AspNetCore.WebSocketsCompression
[Archived] Lib.AspNetCore.WebSocketsCompression is a library which provides a managed implementation of the WebSocket protocol, along with server integration components and support for permessage-deflate compression.
Stars: ✭ 23 (-91.39%)
Mutual labels:  compression, asp-net-core
huffman-coding
A C++ compression and decompression program based on Huffman Coding.
Stars: ✭ 31 (-88.39%)
Mutual labels:  compression
Rocketjob
Ruby's missing background and batch processing system
Stars: ✭ 258 (-3.37%)
Mutual labels:  compression
decompress
Pure OCaml implementation of Zlib.
Stars: ✭ 103 (-61.42%)
Mutual labels:  compression
xamarin-chat-signalr
Xamarin Forms Modern Chat Using SignalR ASP.NET
Stars: ✭ 12 (-95.51%)
Mutual labels:  asp-net-core
netcore-wcf-service-proxy
Example of consuming multiple WCF services using a proxy implementation in a ASP.NET Core Web-application.
Stars: ✭ 42 (-84.27%)
Mutual labels:  asp-net-core
AngularCLI-ASPNET-Core-CustomersService
Example of integrating Angular with ASP.NET Core RESTful Services
Stars: ✭ 61 (-77.15%)
Mutual labels:  asp-net-core
Python Blosc
A Python wrapper for the extremely fast Blosc compression library
Stars: ✭ 264 (-1.12%)
Mutual labels:  compression
OrderAppWithRazorPages
Razor Pages example showing a complex page model
Stars: ✭ 30 (-88.76%)
Mutual labels:  asp-net-core
Graphql Deduplicator
A GraphQL response deduplicator. Removes duplicate entities from the GraphQL response.
Stars: ✭ 258 (-3.37%)
Mutual labels:  compression
AspNet5GeoElasticsearch
ASP.NET Core MVC Geo Elasticsearch Swashbuckle Swagger
Stars: ✭ 38 (-85.77%)
Mutual labels:  asp-net-core
ATOMO
Atomo: Communication-efficient Learning via Atomic Sparsification
Stars: ✭ 23 (-91.39%)
Mutual labels:  compression
Speex
Speex voice codec mirror - THIS IS A MIRROR, DEVELOPMENT HAPPENS AT https://gitlab.xiph.org/xiph/speex
Stars: ✭ 254 (-4.87%)
Mutual labels:  compression
localDataStorage
💼 A handy wrapper for HTML5 localStorage that seamlessly gets/sets primitive values (Array, Boolean, Date, Float, Integer, Null, Object or String); provides simple data scrambling; intelligently compresses strings; permits query by key as well as query by value and promotes shared storage segmentation in the same domain. Key names and values ar…
Stars: ✭ 42 (-84.27%)
Mutual labels:  compression
Unitynuget
Provides a service to install NuGet packages into a Unity project via the Unity Package Manager
Stars: ✭ 257 (-3.75%)
Mutual labels:  asp-net-core
lambda-smush-py
Gain additional code space via cheeky compression for Python AWS Lambda functions defined in-line to CloudFormation templates.
Stars: ✭ 17 (-93.63%)
Mutual labels:  compression
Notify.Me
Simple host application to provide send/receive feature for any kind of notifications and messages between client(s) and the host. The application is based on ASP.NET Core and SignalR to demostrate some features of these things...
Stars: ✭ 28 (-89.51%)
Mutual labels:  asp-net-core
image-comp-lib-rust
Image Compression Algorithm
Stars: ✭ 30 (-88.76%)
Mutual labels:  compression
Imager
Automated image compression for efficiently distributing images on the web.
Stars: ✭ 266 (-0.37%)
Mutual labels:  compression

Build status CI

Smidge Smidge

NuGet

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

Features

  • Minification, 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 (via the Smidge.Nuglify package)
  • 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:
    "smidge": {
        "dataFolder" : "Smidge",
        "version" : "1"
      }  
    
  3. Add smidge to your services:
    services.AddSmidge(Configuration.GetSection("smidge"));
    
  4. Create a bundle in your configure method:
    app.UseSmidge(bundles =>
    {
       bundles.CreateJs("my-application", "~/js/site.js", "~/js/app");
    });
    
  5. Add the tag helpers to your _ViewImports.cshtml file:
    @addTagHelper *, Smidge
    
  6. Render your bundle:
    <script src="my-application" type="text/javascript"></script>
    

See Installation for full configuration details

Usage

Pre-defined bundles

Define your bundles during startup:

services.UseSmidge(bundles =>
{
   //Defining using file/folder paths:
   
   bundles.CreateJs("test-bundle-2", "~/Js/Bundle2", "~/Js/OtherFolder*js");
   
   //Or defining using JavaScriptFile's or CssFile's
   //this allows you to custom the pipeline per file
   
   bundles.Create("test-bundle-1", //bundle name
      new JavaScriptFile("~/Js/Bundle1/a1.js"),
      new JavaScriptFile("~/Js/Bundle1/a2.js"));
       
   //Then there's all sorts of options for configuring bundles with regards to customizing their pipelines,
   //customizing how rendering is done based on Debug or Production environments, if you want to 
   //enable file watchers, configure custom cache busters or the cache control options, etc...
   //There's even a fluent API to do this! Example: 
   
   bundles.CreateJs("test-bundle-3", "~/Js/Bundle3")
      .WithEnvironmentOptions(BundleEnvironmentOptions.Create()
         .ForDebug(builder => builder
            .EnableCompositeProcessing()
            .EnableFileWatcher()
            .SetCacheBusterType<AppDomainLifetimeCacheBuster>()
            .CacheControlOptions(enableEtag: false, cacheControlMaxAge: 0))
         .Build()
   );
});

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:

<script src="my-awesome-js-bundle" type="text/javascript"></script>
<link rel="stylesheet" href="my-cool-css-bundle"/>

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 <link> or <script> html tags. This might be handy in case you need to load in these assets manually (i.e. lazy load scripts, etc...):

Task<IEnumerable<string>> SmidgeHelper.GenerateJsUrlsAsync()
Task<IEnumerable<string>> 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

© 2019 by Shannon Deminick

This is free software and is licensed under the MIT License

Logo image Designed by Freepik

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].