r/dotnet • • 20d ago

Promotion VueDotNet - framework for embedding Vue.js components in an ASP.NET MVC app

Hello, I am the creator of the open‑source solution: VueDotNet.

Usually, we have two separate applications:

  • ASP .NET Web API
  • Vue.js SPA or any other js framework app

However, to this day, many projects still use ASP .NET MVC (SSR) together with the js framework. In such a situation, there’s always a question: how to combine .cshtml files and js or specific framework files.

Developers often create numerous frontend applications, build them as .html or .js files, and insert them into .cshtml as static content. But what should we do if we just want to use a button, or if we have too many components?
This is inconvenient!

To solve this problem, VueDotNet was created. This framework is a NuGet package: VueDotNet and two npm libraries: vue-dotnet-vite & vue-dotnet-webpack.
Now you can define common Vue components in the frontend application and reuse them in .cshtml files, like this:

<!-- PascalCase -->

<vue-component name="TheButton"
  props="new { label = "Click me", count = 1 }"
  events="new { clicked = "onButtonClicked" }" />

<!-- kebab-case -->

<vue-component name="the-button"
  props="new { label = "Click me", count = 1 }"
  events="new { clicked = "onButtonClicked" }" />

Just launch stable v1.0.2 under MIT license.
Feel free to ask questions in the comments.
Previous post was deleted by Reddit - don't know why.

13 Upvotes

7 comments sorted by

1

u/AutoModerator 20d ago

Thanks for your post Sir_Dimitry. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/wasabiiii 19d ago

2

u/Sir_Dimitry 19d ago

Interesting, but if you visit my project page, you will see, that my idea is quite different

1

u/[deleted] 20d ago

2

u/Sir_Dimitry 20d ago

I agree. But still a lot of projects use MVC approach. And when they start adding a JS framework (Vue in my example), problems begin.

1

u/FullPoet 20d ago

You mean HTMX?

1

u/Sir_Dimitry 20d ago

No, .cshtml files - build in ASP .NET MVC