locked
I have used the package Karambolo.AspNetCore.Bundling.WebMarkupMin, Got the error "Cannot convert from 'string' to 'System.Action<System.Collections.Generic.List<Karambolo.AspNetCore.Bundling.IBundleItemTransform>>" with the below code RRS feed

  • Question

  • User2056817590 posted

     app.UseBundling(bundles =>
                {
                    bundles.AddJs("/jquery.js")
                        .Include("/Scripts/jquery-*.js");

                    bundles.AddJs("/jqueryval.js")
                        .Include("/Scripts/jquery.validate*");

                // and so on...
                bundles.AddJs("~/bundles/jqueryval").Include(
                "~/Scripts/jquery.unobtrusive*");

                    // Use the development version of Modernizr to develop with and learn from. Then, when you're
                    // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
                    bundles.AddJs("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*");

                    bundles.AddCss("~/Content/themes/base/css").Include(
                        "~/Content/themes/base/jquery.ui.core.css",
                        "~/Content/themes/base/jquery.ui.resizable.css",
                        "~/Content/themes/base/jquery.ui.selectable.css",
                        "~/Content/themes/base/jquery.ui.accordion.css",
                        "~/Content/themes/base/jquery.ui.autocomplete.css",
                        "~/Content/themes/base/jquery.ui.button.css",
                        "~/Content/themes/base/jquery.ui.dialog.css",
                        "~/Content/themes/base/jquery.ui.slider.css",
                        "~/Content/themes/base/jquery.ui.tabs.css",
                        "~/Content/themes/base/jquery.ui.datepicker.css",
                        "~/Content/themes/base/jquery.ui.progressbar.css",
                        "~/Content/themes/base/jquery.ui.theme.css"
                    );

    Monday, May 3, 2021 6:41 AM

All replies

  • User-474980206 posted

    in .AddCss you can only define one string parameter, the following parameters are transformation functions. use the .Include() to add additional paths.

     bundles.AddCss("~/Content/themes/base/css")
       .Include("~/Content/themes/base/jquery.ui.core.css")
       .Include("~/Content/themes/base/jquery.ui.resizable.css");

    IntelliSense should have shown you this. Do you not use it?

    note: odd that you would use jqueryui in a new project. 

    Monday, May 3, 2021 4:30 PM
  • User2056817590 posted

    getting the exception System.ArgumentException: 'The path in 'value' must start with '/'. ', please help with proper syntax 

    Tuesday, May 4, 2021 5:07 AM
  • User1686398519 posted

    Hi kalvakrishna, 

    According to the error message, you can modify it to:

    bundles.AddCss("/Content/themes/base/css") 
          .Include("/Content/themes/base/jquery.ui.core.css")
          .Include("/Content/themes/base/jquery.ui.resizable.css");

    Best Regards,

    YihuiSun

    Tuesday, May 4, 2021 6:06 AM