Readit News logoReadit News
nbittich · 3 years ago
To me, from the getting started, it looks like yet another JavaScript framework. Might be good, unfortunately I got framework fatigue. My personal website has about 30 lines of javascript, no framework and no library.
strogonoff · 3 years ago
Contrarian take: the whole field of front-end frameworks seems to be lacking an all around good isomorphic solution to me.

Is there anything that would out of the box: 1) do fully static server-side rendering that outputs zero JS by default, 2) still be capable of rendering client-side interactive components where appropriate (for user agents with JS), 3) have both of the above as equal first-class citizens without contrived workarounds needed to achieve either interactivity or SSR, 4) handle all required bundling/fetching at build stage and load fast at runtime, 5) be isomorphic and leverage TypeScript typings to validate the correctness of the whole thing at build time as much as possible, and ideally 6) allow easy reuse of preexisting React components?

mdavidn · 3 years ago
Another comment already mentioned Svelte. Alternatively, Hotwire Turbo or htmx might be more along the lines of what you want. Choose your own server-side language. I sprinkle in fancier frameworks when individual components need it, but this is more the exception than the rule.

https://turbo.hotwired.dev/https://htmx.org/

tzekid · 3 years ago
I'm using Astro + Svelte for a small project right now, and it sounds like that's the combo that you're looking for.
chrisweekly · 3 years ago
Remix (https://remix.run) comes awfully close
no_wizard · 3 years ago
Take a look at Qwik

https://qwik.builder.io/

seandoe · 3 years ago
Remix.run
bdcravens · 3 years ago
The biggest difference is that it uses tags/components as a means to mix markup and code. (the "old" server-side language ColdFusion does this same thing)
creshal · 3 years ago
Remember when PHP was supposed to be that?

Deleted Comment

noduerme · 3 years ago
ColdFusion is an interesting referent ... even as an Adobe subscriber I was surprised to just find out it still exists.
pier25 · 3 years ago
> My personal website has about 30 lines of javascript, no framework and no library.

"my use case doesn't need a JS framework so we don't need JS frameworks"

classified · 3 years ago
That's not what they said.
Existenceblinks · 3 years ago
I still believe good old sever-side rendering + js sprinkle is still the best business value for the buck. Our industry seems to not have analysis on engineering cost compute with business value.
chatmasta · 3 years ago
This is the best way to get Python devs to start using JavaScript. But if you're already writing in JavaScript (or TypeScript), why wouldn't you want to re-use the code on server and client? Next.js is basically modern day PHP - you create a file in /pages/foo/bar.ts and it renders at localhost:3001/foo/bar. It really doesn't get much easier than this, and anyone complaining about it has likely not tried it or doesn't have a green field project where they can start from scratch with TypeScript and Next.js.

Also, this trope that "JavaScript can only render websites that require JavaScript to read" is a common misconception. Next.js, for example, is perfectly capable of rendering websites that work for clients with JavaScript disabled. In fact, that was kind of the original point of SSR: to make websites that search crawlers could read by processing the HTML sent from the server. The server renders the initial page, and then the client (optionally, if following best practices) "hydrates" the DOM to render any further content that requires client-side interaction (indeed, it's bad practice to require hydration, and a mismatch between server rendered DOM and hydrated DOM will generate warnings in development).

anileated · 3 years ago
I wouldn’t say the state of the art is particularly great, but interestingly enough server-side rendering + JS sprinkle is exactly what many modern frameworks like Marko are going back to.

They provide some opinionated/convenient ways to author code but deliver fully server-side rendered HTML. They use fancy means to detect where interactivity is needed, and only ship JavaScript to the browser for those components.

In fact, they make what you describe easier to achieve. When you do it on your own, it’s up to you to ensure one piece JavaScript doesn’t mess another piece up, it’s up to you to sync back-end with front-end—but with a good framework you get encapsulation, bundling, and typing with compile-time checks (if you removed an attribute from some object server-side but forgot to update the client side, your build will fail with a useful error message before you can deploy it).

ARandomerDude · 3 years ago
Your specific recommendation really depends on your use-case.

But I think the general principle applies, and you can even go further: try building simpler things. This is why I use static websites + a little JS and some API calls until I absolutely need my own server/SPA/etc.

Existenceblinks · 3 years ago
The technical lead needs to explain and link between highly interactive widget to business value. Breaking down feature/value to pieces and link each to what type of widget it needs. JS frameworks always sell like lets build the whole thing with this whole tools. It's not only not fined-grain solution, it's often mismatched.

I don't buy the isomorphic thingy that reduces cognitive load because that's not only it's not absolutely true, it could be false and brings other type of problems.

leke · 3 years ago
I recently found htmx that allows me to do something like this in any backend language.
Existenceblinks · 3 years ago
I elaborate under the other comment. Htmx is good as long as there's not a lot of business value that needs highly interactive widgets. The whole thing is highly interactive sounds like a attempt silver bullet. The isomorphic invention currently doesn't solve client-server problems at all, it only solves 'I want to use one language' problem. Data still needs to live somewhere and move to somewhere, and there's physical distance between them, so it still has problems due to that condition.
satvikpendem · 3 years ago
I agree, that's why I like NextJS that gives you the DX of thinking in reusable and composable components (React) and type safety (TypeScript) that then ships no JS at all to the client.
andrei_says_ · 3 years ago
Exactly.

slim-lang + htmx or stimulusjs and a single dev can replace a team.

0xblinq · 3 years ago
Totally agree with this.
mhd · 3 years ago
That's the ebay templating system, right? Has been around for almost 10 years, but never gained that much traction.
no_wizard · 3 years ago
Solid JS guy cut his teeth maintaining it
pier25 · 3 years ago
I don't think so. IIRC Solid existed years before Ryan joined the Marko team.
OJFord · 3 years ago
And eBay is easily the jankiest website I use on an at all frequent basis. Click about in profile/settings and you get randomly shuttled about between pages designed in (by the looks of them) 2010, 2002, 2003, and 2016...
eggie5 · 3 years ago
yes and doesn't have traction inside ebay either :)
mpeg · 3 years ago
I don’t have inside info like you might, but it seems like a mean-spirited comment considering ebay.com uses marko, as well as other sites in the ebay group.

It definitely has not gained a lot of traction outside of ebay but there is a fair amount of buzz around the marko6 release with a completely new tags-based language.

It is also one of the few frameworks that leverage html streaming in a simple way (and has for a long time) and offers islands-style partial hydration out of the box.

LudwigNagasena · 3 years ago
That

    <if(user.loggedOut)>
        <a href="/login">Log in</a>
    </if>
And that

    <ul>
        <for|color, index| of=colors>
            <li>${index}: ${color}</li>
        </for>
    </ul>
Looks scary. ${index} and ${color} require escaping, (user.loggedOut) requires parentheses and |color, index| requires pipes. I just don’t understand what is going on.

What I like React for is that I can use JavaScript for things that seem to belong to JavaScript, like conditionals and loops. And components just have properties that may be dynamic and conditioned, in which case they obviously require JavaScript. But here the syntax breaks that separation of concerns IMO.

pmontra · 3 years ago
Maybe it's only me because I'm not a frontend developer and obvious things are not obvious to me, but it seems that there is nothing in the docs about deploying to a server and visiting a page it with a browser.

Anyway, I traced the JavaScript code. There are files packed with Webpack. They're not minified and pretty easy to follow. I even found a comment linking to https://github.com/gorhill/uBlock/issues/205 with the note "Do not handle added node directly from within mutation observer".

mpeg · 3 years ago
There are some docs on how to deploy for different node servers (express etc) as well as an examples repo which has templates for different environments.

I run Marko on cloudflare pages for some of my clients and couldn’t be happier, it’s the perfect framework for people who like writing plain html, but still want the advantages of a UI library like react.

bluelightning2k · 3 years ago
Looking through the examples, it looks exactly like Svelte syntax.

Not saying this is a bad thing. Svelte is universally loved.

But it does raise the obvious question of why not Svelte. (Or Solid or Astro or...)

yuchi · 3 years ago
Marko predates scelte, by at least 3 years
pier25 · 3 years ago
Svelte doesn't have partial hydration which Marko has had for years. Otherwise their SEO and CWF would have suffered.

Same with HTML streaming. Marko has had it since 2014 and IIRC SvelteKit doesn't have it yet.

I absolutely love Svelte but if you need those features then Marko would be a better choice.

anileated · 3 years ago
Per some tests as of last year[0], Marko[1] is much more performant than Svelte, which matters a lot for UX and for page rankings (especially in case of more complex sites).

I’d expect Qwik to be faster than any of the above, but it seems not quite production-ready enough.

[0] https://dev.to/this-is-learning/marko-for-sites-solid-for-ap...

[1] In the Reddit the author mentions that, despite focusing on Solid+Astro in the article, Marko is actually still more performant than those: https://www.reddit.com/r/javascript/comments/ubs6i9/marko_fo...

beeb · 3 years ago
Latest independent benchmarks indicate otherwise https://krausest.github.io/js-framework-benchmark/2023/table...
ianpurton · 3 years ago
One thing that's important for me is a design system and components. I want to write markup like this.

''' <tabcontainer> <tab> ... </tab> </tabcontainer> '''

So any markup technology these days needs that ability I think.

Then there's Content Security Policy to think of too.

2Pacalypse- · 3 years ago
Based on the fact that this language shares the same name as me, I think it's one of the most beautiful languages that has ever existed.

Jokes aside, this does look pretty neat.

orra · 3 years ago
Nice to have a connection!

It looks like Marko v6 is going to perform incredibly fast, up there with vanilla javascript and solidjs, ahead of Vue, React, and Angular. https://dev.to/ryansolid/marko-compiling-fine-grained-reacti...

What's interesting is Marko and Solid are opposite in some ways: the first is HTML first, with sprinkles of interactivity; and the second is JavaScript first, in that it uses JavaScript and JSX primarily. Despite these opposite approaches, they are both iterating towards having very little runtime overhead.

mpeg · 3 years ago
You joke, but we get kids in the discord constantly because they try their name as the discord invite code!
philipphutterer · 3 years ago
lmfao, this is so hilarious.