Getting Real
I've just started exploring stencil and am already nursing a crush.
I will be the first to admit that I don't particularly...
For further actions, you may consider blocking this person and/or reporting abuse
I also landed on Stencil after trying all of the other big frameworks and built my site with it. It just feels right. It seems like other front-end libraries are "hacking" the web to get it to do their bidding, while Stencil embraces it and provides the same convenience as those frameworks. It is hard to justify the investment of learning a front-end framework that is not compatible with anything else and may eventually be replaced by the next big thing in 3-5 years. My only complaint so far is using JSX with it, I think I would prefer a template approach instead, but everything else has worked well.
My first impression was the same as yours, I would have rather like to use template, but now? I would like to use TSX everywhere 🤣
Cherry on top, I think, it could help developers with prior React experience to easily step in Stencil and likewise, for developers without React experience, it could help to step in React.
How tricky would this be to make work work with the tools as-is? I know the
stencil
tool does operate on a set of assumptions but at a glance this seems like the sort of thing you could do.I think it can be done. I set up lit-html in Stencil and it seemed to work, but was kind of weird because I had to create a dummy element to attach lit-html to and call
render() { render( document.querySelector("element") ) }
. I'm sure that probably negated any compiler optimizations in Stencil. There might be a better way to do it, but I haven't explored it too much.It's nice to hear of somebody else who doesn't particularly enjoy building frontends. It seems sometimes that everyone is so passionate about web frontend development. I think building web frontends is a mess and no fun, but because it's 2020 I can't get away from it. It makes me feel like I'm the only one that feels that way! Good to know I'm not alone!
I think some of that might be perceived bias - DEV in particular is pretty frontend focused but it really is just a subset of all the engineering going on - thankfully so!
Great article Ben, thx for the share 👍
If I understand correctly what the Stencil team is currently cooking and also understand correctly that you like Rust, I might not be wrong saying that you might even gonna love more Stencil soon 😉
Check out this recent tweet from @adamdbradley 👉 twitter.com/adamdbradley/status/12...
You just made my month.
I've noticed that you have written some Rust articles, I know Rust/wasm is not production ready yet (that is of course always debatable), but did you take a look on that?, how far from ready is it?,
I'm working in a personal project with Actix-web and soon I'll start dealing with the client side, I haven't started a heavy research on the client side yet but from what I've heard I'm considering: Svelte, Stencil or something in Rust, maybe Seed or Percy, but there seems to be very uncertain yet.
Did you considered some wasp alternative?, any interesting discovery on that front? or is too new/experimental yet?
Yep - My old site is in
actix-web
, and I plan to continue writing servers inhyper
. Part of my goal here is to get more familiar with a more mainstream tech, so TypeScript was a primary driver.As far as frontends go, I've tried both Yew and hand-rolling with web-sys - I wrote a quick write-up of the latter here:
Reactive Canvas with Rust/WebAssembly and web-sys
Ben Lovy ・ Jun 14 '19 ・ 11 min read
I think "uncertain" is exactly the word. Not a lot of "1.0" level crates, so you have to expect breaking API changes. I think this should be revisited after everything has had more time to bake, but is an exciting tech to watch.
For simple frontend sites, though, Rust is overkill. JS/TS is the right tool for a lot of cases. If you're doing all your work server-side, then it's a little more robust. I really like
hyper
.For frontends, I've wanted to try
seed
for a while, would be curious to hear how it goes if you do. For rust web servers, I'm most excited about tide but again, we're a little early for it to be ready for use.As for whether Rust is "production-ready" in a general sense, I think there are domains where it absolutely is, but the big thing that needs to happen is a larger set of "1.0"-stable crates.
I guess we'll have to wait and see on the client side, in the server side I'm really happy so far with Actix-web, it was kinda hard for me at the start but once you start to get in the groove you even start to enjoy the API docs :D
PS: If you find yourself in the curious mode, take a look to SQLx (is a Rust SQL toolkit fully async with async-std and has forbidden non-safe code 8-o ) I just found it and look very promising, far from 1.0, but looks great.
I was also thrilled with actix-web 0.7, but the 1.0 breaking change threw me for a lurch and I haven't spent the time to sit down and learn the new API - I really should.
I saw a reddit post about that - looks very cool. The Rust ecosystem is full of cool stuff. Today I'm playing with cxx, a safer way to interface C++<->Rust than
bindgen
. It's like getting cool new toys every day.I liked Stencil at first but found event dispatching and handling to be unreliable and buggy. Haven't given it a second try in a while. Did you find handling events simple and reliable?
I use many events and handlers and never had trouble related to Stencil, even the contrary, I found easy to implement and reliable. Events are a core mechanism of our editor.
Only difficulty I once had was with the selection API but that's not related to Stencil but rather with the platforms and the compatibility of such API with Shadow Dom.
Interesting - that's good to know. So far in this app I've only handled
onLoad
andonClick
and haven't needed to dispatch anything myself, so it's way too early to tell. How long ago did you try it?I think around August. A lot of the event handlers would fire only once or not at all.
Yikes. Will definitely be on the lookout for that, but so far so good.
I've had a great experience so far in building apps with svelte and sapper and ability to include web components and output web components . It seems like a good move to bet on web components but the way to create them is extremely verbose . I have a broader solution workspace when building in svelte , it's so close to html, CSS and plain js that the barrier of entry is low . For the new web app projects , I recommend to have a setup where the solution can accommodate web / vanilla js components with a server side framework that does a lot of heavy lifting . We cannot future proof everything , but atleast be prepared for it when someone comes along with a game changing idea
I've definitely still had my eye on this, next time I'm looking to set up a more interactive page I'd like to dive in.
Angular is pretty similar syntactically to Stencil, for what I have seen. Also, Angular has a way to create web components called Angular Elements. I haven't looked in to it much, but it's seems cool