4 ms·
This looks bad. I see custom syntax, and JavaScript embedded into HTML in a way that cannot be syntax-checked at build time. If you want a lightweight framewor
by flowerlad 5y ago
This looks bad. I see custom syntax, and JavaScript embedded into HTML in a way that cannot be syntax-checked at build time.
If you want a lightweight framework check out UIBuilder instead: https://github.com/wisercoder/uibuilder https://github.com/wisercoder/uibuilder
Same JSX syntax as React, but this lib is very simple -- just over 200 lines of source code.
- tlamponi 5y agoThere's no custom syntax, they only use existing HTML language features, namely element attributes. Custom syntax would be something that is not already a syntax, i.e., language feature, in HTML. And why exactly should this not be checkable at build time? The attributes are defined, their use too, it's as checkable as any JavaScript framework. If you're using TypeScript, or the like, then you'll naturally get much more things that can be checked, but those are type checks and not syntax checks, i.e., something completely different. Don't get me wrong, personally I'm all for static typed, and schematic frameworks but that's completely orthogonal to using (custom) HTML attributes, and has nothing to do with syntax checks. I mean, if syntax could not be checked it couldn't be parsed at all...
- flowerlad 5y agoThis looks like custom syntax to me: x-for="post in posts" You can argue that this is just an HTML attribute, so it is existing syntax. But it appears to be a way of looping through items in a collection, and as such it is neither HTML nor JavaScript, and therefore it is a custom syntax. It is not checkable at build time if there is no checker available.
- SomeCallMeTim 5y agoI 100% agree, and I don't see why you're being downvoted. I frankly see this approach as the Wrong Way at this point. I hate that every new framework comes out with its own take on HTML attributes. And zero TypeScript support? Seriously? This is a non-starter framework.
- webreac 5y agoI do not see it like this. I will not suggest this is the proper way to do a big web application. Similarly, bash is not the proper language to use for a serious software but for very small tasks, bash may be enough. Similarly, when you build a MVP, this mini framework is probably sufficient and even when your project matures, removing this framework will not be the priority.
- flowerlad 5y agoExcept, this "mini framework" is not really easier than React and when the project matures, replacing it with a real framework will be a huge hassle.
- zkldi 5y agoCompletely agree. Whenever html attributes start containing logic is when the templating engine has just implemented its own programming language - poorly.
- SomeCallMeTim 5y agoYup. Regretfully we seem to be in the minority, though. I expect more of the HN readership, but apparently the instant gratification culture permeates it here as well.