Mike-Ward.Net

Introducing Nancy.Pile

Nancy.Pile is a super simple asset bundler for NancyFx.

Features

  • Concatenates and minifies style sheets and JavaScript files.
  • Won’t minify files with “.min.” in the file name.
  • Nuget package or include a single file in your current package.
  • Detects when files change.
  • Wild card file matching with duplicate detection (useful when ordering matters)
  • Uncompressed bundles insert comment with file name for each file for easier debugging.

Install

PM> Install-Package Nancy.Pile

Example Usage

public class Bootstrapper : DefaultNancyBootstrapper
{
    protected override void ConfigureConventions(NancyConventions nancyConventions)
    {
        base.ConfigureConventions(nancyConventions);

        nancyConventions.StaticContentsConventions.AddStylesBundle("styles.css", true,
            new[]
            {
                "css/pure.css",
                "css/*.css"
            });

        nancyConventions.StaticContentsConventions.AddScriptsBundle("scripts.js", true,
            new[]
            {
                "js/third-party/*.js",
                "js/app.js",
                "js/app/*.js"
            });
    }
}

And reference the bundles in HTML

<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Nancy.Pile.Sample</title>
  <link href="~/styles.css" rel="stylesheet" />
  <script src="~/scripts.js"></script>
</head>
← newer older →
.Net, Technology, Life, Whatever

Recent Posts

Tweetz Desktop Support for 280 Characters
Quick Tip - Clear ReSharper's Cache to Fix False Errors
Quick Tip - Refined GitHub
Vertical Layout for HTML Tables
Visual Studio 2017 Installer Quick Tip
VSColorOutput for VS 2017 Released
Quick ReSharper tip for inline templates
More... (1078)

Donate with PayPal