cssasp.netcassette

How to minify css in a folder ASP.net


I have CSS files in a folder and I am planning to minify them usign cassette So far

I have created a class

    public class CSSBundleHelper : IConfiguration<BundleCollection>
    {
        public void Configure(BundleCollection bundles)  
        {
            var BundlePath =      ConfigurationManager.AppSettings["CSSBundleFolder"];
        var path = ConfigurationManager.AppSettings["CMSSitesPath"];
        bundles.AddPerSubDirectory<StylesheetBundle>(path);
        }
    }
}

Since the files are in a folder, i do not have an Idea how to call to this function and do the bundling . I will be happy if someone can guide me


Solution

  • If your css files are in one folder, just pass an application-relative path to bundles.Add(path-to-css-folder)

    Then to use this bundle i.e. in Razor: add @Bundles.RenderStyleSheets()