C# for site
Posted by Quiet_Amoeba_3716@reddit | learnprogramming | View on Reddit | 12 comments
My friends and I are planning to start building our own website, and I hate JavaScript. Is there any way I can replace it with C# or something like that? I want to write the front end in HTML and CSS.
jlanawalt@reddit
Sure, use the most modern html constructs you can and tie a hand behind your back and admit you can’t do some of the more dynamic things every other web site does. There are things like WASM, but JavaScript is the language natively supported by all the major browsers.
You could bang your head against the wall trying to compile C# to JS.
You could use a backend web engine that writes the JS for you, and hope you don’t have to debug it.
You could learn to tolerate JS, maybe with TypeScript handrails.
Good luck!
Ormek_II@reddit
You said the major point:
spinwizard69@reddit
I understand the hate of JavaScript.
One consideration is to simply create Static web pages. If not search for the various compilers that generate Javascript from other languages.
8Erigon@reddit
I don't understand how they don'T hate CSS
plastikmissile@reddit
Why not use TypeScript? It was designed by the same guy who designed C#, it's much better than vanilla JS, and compiles directly to JS without much trouble.
Backtawen@reddit
I Agreee .. 👍🏻👍🏻👍🏻👍🏻
Jonny0Than@reddit
+1 for typescript.
Backtawen@reddit
blazor does exactly this, c# instead of js for frontend. but fair warning its still pretty niche and the job market for it is thin
for a personal project with friends its fine. just dont expect to find many stackoverflow answers when you get stuck lol, but i think u have Ai by your side
purpl3un1c0rn21@reddit
The docs for Blazor are actually some of the better and more informative MS docs that exist, except for auth which seems to have large chunks missing or inferred by knowledge I do not have and are out of date with more recent update terminology and project layouts.
AI was pretty crap at Blazor, Copilot is now only half bad at it and can walk you through structure and new features quite well. I find it struggles with debugging multi layer issues in the application eg. race condition in services or middleware causes rendering issue. It can do simple issues easily though and can take you through a CRUD app if you already know HTML/CSS/C#.
I would actually reccomend away from component libraries unless you dont know and have no immediate intentions of learning HTML/CSS. MudBlazor is really easy to use and looks nice though.
Dazzling_Music_2411@reddit
Loads of languages compile to JS these days, it has almost become the default compilation target.
BionicVnB@reddit
There's Blazor iirc
AnnuallySimple@reddit
Yeah Blazor is solid for this, lets you write C# instead of JS for the frontend stuff. You can do either server-side or WebAssembly depending on what you need