# Convertion of Render CSS / packages in master page

**URL:** <https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222>\
**Category:** Discussion in English\
**Created:** [June 29, 2024, 8:17am UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222 "2024-06-29T08:17:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![scoachtom](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/scoachtom/32/41_2.png) [@scoachtom](https://forum.dotvvm.com/u/scoachtom)\
**Post date:** [June 29, 2024, 8:17am UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222/1 "2024-06-29T08:17:46Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![scoachtom](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/scoachtom/32/41_2.png) [@scoachtom](https://forum.dotvvm.com/u/scoachtom)\
**Post date:** [June 30, 2024, 10:36am UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222/2 "2024-06-30T10:36:15Z")

</div>

ok, I found this now in the documentation:

[Bundling and minification | DotVVM Documentation](https://www.dotvvm.com/docs/4.0/pages/concepts/script-and-style-resources/bundling-minification)

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???

---

<div class="post-metadata">

**Author:** ![exyi](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/exyi/32/9_2.png) [@exyi](https://forum.dotvvm.com/u/exyi)\
**Post date:** [July 1, 2024, 6:34pm UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222/3 "2024-07-01T18:34:04Z")

</div>

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](https://www.dotvvm.com/docs/4.0/pages/concepts/script-and-style-resources/overview). I don’t think you need the BundlingResourceProcessor, that’s necessary when you want to replace certain set of resources with another one.

---

<div class="post-metadata">

**Author:** ![scoachtom](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/scoachtom/32/41_2.png) [@scoachtom](https://forum.dotvvm.com/u/scoachtom)\
**Post date:** [July 1, 2024, 6:37pm UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222/4 "2024-07-01T18:37:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![exyi](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/exyi/32/9_2.png) [@exyi](https://forum.dotvvm.com/u/exyi)\
**Post date:** [July 1, 2024, 6:57pm UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222/5 "2024-07-01T18:57:41Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![scoachtom](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/scoachtom/32/41_2.png) [@scoachtom](https://forum.dotvvm.com/u/scoachtom)\
**Post date:** [July 2, 2024, 6:18am UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222/6 "2024-07-02T06:18:57Z")

</div>

> [@exyi](#):
>
> only to register a pre-generated bundle (the “mybundle” is a standard resource registered with the `config.Resources.RegisterX(...)` method).

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?

---

<div class="post-metadata">

**Author:** ![exyi](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/exyi/32/9_2.png) [@exyi](https://forum.dotvvm.com/u/exyi)\
**Post date:** [July 2, 2024, 8:53am UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222/7 "2024-07-02T08:53:00Z")

</div>

The bundle is just a resource, which is described here: [Script and style resources overview | DotVVM Documentation](https://www.dotvvm.com/docs/4.0/pages/concepts/script-and-style-resources/overview).

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

```

---

<div class="post-metadata">

**Author:** ![scoachtom](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/scoachtom/32/41_2.png) [@scoachtom](https://forum.dotvvm.com/u/scoachtom)\
**Post date:** [July 2, 2024, 4:31pm UTC](https://forum.dotvvm.com/t/convertion-of-render-css-packages-in-master-page/222/8 "2024-07-02T16:31:23Z")

</div>

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!
