Convertion of Render CSS / packages in master page

How do you convert these lines for example to DotVVM?:

<%: Styles.Render(“~/bundles/CssStyles”) %>
<%: Scripts.Render(“~/bundles/jQuery”) %>

ok, I found this now in the documentation:

Bundling and minification | DotVVM Documentation

when I put this in the startup.cs the site tells me that “mybundle” cannot be found.

Where and how do I register the bundle???

I don’t really know what does the Styles.Render method do. If you just want to include a JS/CSS file in the page, you can just use a script/link rel=stylesheet tag (the ~/ prefix does get expanded in the src/href attributes).

If you want a smarter resource management (caching, script deduplication), you can use the DotVVM resources: Overview | DotVVM Documentation. I don’t think you need the BundlingResourceProcessor, that’s necessary when you want to replace certain set of resources with another one.

well, Render just does the bundling.
That’s the reason I posted the second message.

how can you register the expample in the documentation “mybundle”?
it is not found when you load the page

Ok sorry, then DotVVM cannot do bundling on its own. The BundlingResourceProcessor is there only to register a pre-generated bundle (the “mybundle” is a standard resource registered with the config.Resources.RegisterX(...) method).

You’ll have to use an external tool like esbuild to do the bundling and minification. I can’t find what exactly did Asp.Net use for that (is it just concatenating the files?), maybe there is an easy way to run it during build. Alternatively, you can just register the script separately and use them unbundled

can you be more specific to this one?

in the documentation it is this example:

var bundling = new BundlingResourceProcessor();
bundling.RegisterBundle(dotvvmConfiguration.Resources.FindNamedResource(“myBundle”), “script1”, “script2”);
dotvvmConfiguration.Resources.DefaultResourceProcessors.Add(bundling);

when you include this from the example in the Startup.cs and add “<dot:RequiredResource Name=“myBundle” />” to the Main.dotmaster the browser tells you:

“The resource “myBundle” could not be found. Make sure it is registered in the startup cluss.”

so how and where exactly do you register the example in the project?

The bundle is just a resource, which is described here: Script and style resources overview | DotVVM Documentation.

config.Resources.Register("myBundle", new ScriptResource() {
    Location = new FileResourceLocation("Scripts/bundled-scripts.min.js"),
});

oh, ok, then I understood it not correctly.
I thought it was a tool where you create your “bundled-scripts.min.js” for example

Thank you!