9 ms·
Stencil – A reusable web component generator
- KevanM 9y agoGosh, the content is illegible on Chrome and Windows 8. 14px and a lightweight font does not make for happy reading.
- sooheon 9y agoIt's more the OS than the font choice, different OSes render text better or worse. The site looks great on a 15 inch macbook pro.
- eat_veggies 9y agoDesigners only looking at their sites on their MacBook Pros is exactly what produces these pretty but unreadable websites.
- Mtinie 9y agoAdding a "Yes, but..." Microsoft's refusal, or inability, to release a version of Edge (or even a port of an earlier IE) for macOS exacerbates this situation. I virtualize Windows on my MacBook for IE/Edge testing of my designs and code, but it requires a workflow and context shifting that I'd perfer I didn't have to do. Edit: s/I.E./IE
- jeffhuys 9y agoWith Parallels that's at least a bit less painful, but yeah, we shouldn't need to virtualize at all.
- mediumdeviation 9y agoIronically we have the exact same problem, except worse with Safari, since it has (relatively) poor support for some cutting edge APIs, and unlike Edge/IE we can't even legally test it in a VM because Apple doesn't even allow their OS to be put in a virtual machine. At least Microsoft has the good grace to put up free VMs for browser testing - https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ https://developer.microsoft.com/en-us/microsoft-edge/tools/v...
- sampath-lokuge 9y agoYou can rent a MAC server here: http://www.macincloud.com/ http://www.macincloud.com/
- hungerstrike 9y agoAt least you don't have to buy a whole different computer to do your job. I have to buy a Mac just to test websites and compile apps for iOS. The only way for me to avoid using the Macintosh OS or having to buy a Mac is to switch careers or specialize. Thankfully, cross-platform kits such as Cordova and React-Native let me use my preferred OS for development most of the time!
- mrmondo 9y agoAnd on an iPhone 7 running iOS 11.
- KevanM 9y agoWell, I'd disagree and say they are the ones who picked the fonts: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol" And have picked one on Windows that does not render well at the size and weight they want to display the text. They could have had a more universal font selection like Arial.
- WA 9y agoI was about to defend the choice made, because they use a typical system font stack, just like GitHub. But it was deliberately set to `font-weight: 300` (light), which really is unreadable on anything but "retina" displays.
- yesimahuman 9y agoThanks for the note, the site is a rapid work in progress! Will get that fixed soon
- SycamoreFox 9y agoSure looks terrible on Edge, Chrome, and Firefox on Windows 10. Gray on gray makes for terrible contrast.
- jgw96 9y agoHello all! We just deployed a new version of the site that should solve some of these problems, thanks for the feedback.
- ubersoldat2k7 9y agoI'm not sure I'm understanding the point behind this. If the main point is to allow people to reuse components (i.e. a calendar widget) across frameworks, then good, but it's going to be quite messy when things start to get complicated and we start hitting integration problems, because some guy on the Internet writing a widget is not going to test & maintain it on all frameworks. It also bothers me the whole Typescript deal. I might be wrong, but I don't want to have Typescript installed & integrated into my build process so I can use a widget. The only way I can see this working out is that I suck it and follow the Typescript paradigm or widget creators can distribute their widgets on some sort of "built" pure JS file, something like JAR files... and we know how well that goes.
- manucorporat 9y agoHere an engineer at Ionic. You don't need to integrate typescript to use a "widget" generated with Stencil. Stencil is a compiler that generates vanilla web components in javascript. You can just import the generated .js and use the component just like a "button" or native "input".
- ubersoldat2k7 9y agoGreat, that makes so much sense. But then, how about other dependencies that might come into play? For example, underscore, is that "packaged" with this generated JS file or some other way around? Thanks for the prompt response BTW.
- manucorporat 9y agoNo, Stencil.js is like a "real stencil", it is used to produce something, but it is not in the final product. There is nothing like "window.stencil" or any stencil related API in the output of the stencil compiler. It generates vanilla JS web components without dependencies. The documentation of stencil linked in this HN post was in fact created with stencil itself. Just open the Dev Tools!
- 9y ago
- jazoom 9y ago"Stencil is a new approach to a popular idea: building fast and feature-rich apps in the browser. Taking advantage of new capabilities in the browser, such as Custom Elements V1, Stencil enables developers to write faster and lighter components without the weight of frameworks. The tooling also a solution to teams and library authors building components that support many frameworks. Stencil components work in Angular, React, Ember, and Vue as well as they work with jQuery or with no framework at all, because they're just standards-based components. Compared to using Custom Elements directly, Stencil provides extra APIs that makes writing fast components simpler. APIs like Virtual DOM, JSX, and async rendering make Stencil Components easy to approach, while maintaining compatibility with Web Components" So which browsers would this work in?
- andreashansen 9y agoCustom elements v1: http://caniuse.com/#feat=custom-elementsv1 http://caniuse.com/#feat=custom-elementsv1
- ubersoldat2k7 9y agobasically Chrome (I just saved you a click)
- andreashansen 9y agoAlthough, their demo works perfectly fine in Firefox: https://corehacker-10883.firebaseapp.com/ https://corehacker-10883.firebaseapp.com/
- Mayzie 9y agoIt's probably using a polyfill for the functionality.[1] [1] - https://www.webcomponents.org/polyfills#custom-elements-polyfill https://www.webcomponents.org/polyfills#custom-elements-poly...
- jazoom 9y agoIf this is true it's not practically useful yet. There must be more to it.
- manucorporat 9y agoFact: The website linked in this HN (stenciljs.com) was itself created with stencil. I encourage you guys to open the Dev Tools and dig into it!
- deleted 9y ago[deleted]
- arxpoetica 9y agonice diamond emoji
- factsaresacred 9y agoThis could be amazing, whatever it is. But that's the problem. I have to squint to see the font, there's two headers with two different slogans and a paragraph consisting of 12 words that tell me to go to the docs without providing a link. The rest of the landing page is white-space. Come on. Woo the visitor. First impressions are everything, and this fails. At the very least move 'What is Stencil?' to the landing page.
- yesimahuman 9y agoShould be fixed soon thanks.
- g105b 9y agoHere's a new library to solve a problem you don't have yet.
- andreashansen 9y ago> "Here's a new library to solve a problem I don't have yet." Fixed that for you :)
- yesimahuman 9y agoWe built it at Ionic to solve a problem we do really have. Might be useful to others, we hope :)
- dmitriid 9y agoWebComponents in general are a solution in search of a problem. Despite being 6 years in development: - they basically delivered none of the original promises - they are extremely cumbersome to use without a library/framework on top (Polymer is the jQuery of WebComponents) - they are plagued by multiple problems and shifts in the ecosystem (browsers don't want to support `is=`, HTML imports are being dropped in favour of ES6 imports) - they have multiple problems integrating with existing frameworks: https://custom-elements-everywhere.com https://custom-elements-everywhere.com (basically any framework that bastardises HTML syntax is ok, anything relying on Javascript only is in trouble) Don't hold your breath for the next couple of years as everyone tries to figure out how to work with them.
- ergo14 9y ago> WebComponents in general are a solution in search of a problem Maybe they don't solve your problem, but they certainly seem to solve Ionic's or Netflix's problems (or mine for that matter).
- dmitriid 9y ago"React seems to solve Facebook's problems (or mine for that matter)" "Vue.js seems to solve Gitlab's problems (or mine for that matter)" etc. Throwing big names around amounts to pretty much nothing.
- Vinnl 9y agoHuh, that's a rather interesting approach to building Web Components. I'll have to see if it gets anywhere, but the idea has potential, and feels like it avoids many of the pain points of Polymer (although I'm not quite sure yet which you'll get in return).
- ergo14 9y agoYeah, indeed it does look really nice, the API feels a bit weird though, not sure why lifecycle events are named after react.
- yesimahuman 9y agoWe are fans of react and think the events fit the component model well, it's not a perfect 1-1 though
- yesimahuman 9y agoHey all, founder of Ionic (team behind Stencil) here. Didn't expect to see this up on HN so soon (released this morning), thanks for understanding there's still rough edges with docs, etc We built Stencil for a selfish reason: we needed more mobile web performance for Ionic apps being deployed as PWAs (in addition to App Store apps) and we were struggling getting that with traditional framework component/bundle approaches. We realized web components were a way forward and would let us reach more of the web dev community that wasn't just using Angular. However, we felt like there were some big framework features missing from vanilla custom elements (vdom, react fiber style rendering queue, etc), so we built stencil to make it easy to generate web components with these features baked in. Along the way we figured other teams would benefit and pulled it out into its own project. Stencil will be used in the next version of Ionic so we are dog fooding this hard, and web components it generated will be in use by thousands of Ionic devs soon. We just announced this at the Polymer Summit in Copenhagen this morning and the talk is up if you're interested: https://youtu.be/UfD-k7aHkQE https://youtu.be/UfD-k7aHkQE Happy to answer any questions!
- dgregd 9y agoHow Stencil will change Ionic (Angular) apps? As far I understand it will add real lazy loading, which should greatly reduce startup time. What are other benefits? What about Ionic v4 apps? Will Angular still be used? How we are going to write our app components, they will be based on Angular or Stencil? What about Cordova hybrid apps? Do you plan to support them or focus exclusively on PWA apps?
- yesimahuman 9y agoFirst of all, Cordova/App Store apps are still our main focus. However, we are incredibly excited about PWAs and will adjust based on where the market goes. This stuff is still new! Second of all, we will continue to support building Ionic apps with Angular. In fact, you shouldn't really notice any difference, we've just turned a number of the Ionic components into web components. It'll be fairly seamless but performance on load and code size should improve by a fair margin. Long term? It's hard to argue against web components being a superior deployment option for both our components and your apps, so if developer preference shifts in that direction we might push stencil/web components as the default. Time will tell
- jblz 9y agoHow is this licensed? Perhaps I'm missing it, but I can't seem to find mention of it on the site or in the repo: https://github.com/ionic-team/stencil https://github.com/ionic-team/stencil
- yesimahuman 9y agoAh good catch. It's MIT (will get that up soon)
- chrisco255 9y agoHave you considered a BSD + PATENTS license? :P
- ergo14 9y agoNothing wrong with that. In fact google releases quite a few projects like that - the important thing is what is inside the patents clause. Apache 2.0 also has one and no one argues against it.
- vijaybritto 9y agoIf we use third party library code in multiple stencils. Will they be included separately in each one of them. Let's say d3 for graphics?
- yesimahuman 9y agoYes right this second, but next on our list is providing a seamless solution to dependency dedupe. Not yet ready but it's promising.
- vijaybritto 9y agoOkay, that is definitely needed if we want to build serious components. Else it's gonna go crazy heavy!
- danbucholtz 9y agoA simple solution today would be to put the shared, heavy code in it's own component and call methods directly on that component. That's how we're share code across components in Ionic.
- ospatil 9y agoCould you please add an example of this in the documentation? It looks great BTW.
- tech-no-logical 9y agocontent won't show for me (latest firefox beta, 56b05) : Failed to register/update a ServiceWorker for scope ‘https://stenciljs.com/docs/’: Bad Content-Type of ‘text/html’ received for script ‘https://stenciljs.com/docs/sw.js’. Must be ‘text/javascript’, ‘application/x-javascript’, or ‘application/javascript’. Error DOMException [SecurityError: "The operation is insecure." code: 18 nsresult: 0x80530012] intro:19:41
- jgw96 9y agoRefresh on the home page and it should be fixed (:
- tobeeey 9y agoThis sounds awesome! The Github link on the website should probably link to the main repo instead of stencil-site?
- yesimahuman 9y agoGah! Thanks, fixing now
- hungerstrike 9y ago> Stencil components are rendered using JSX... What's the point? Why not just use React? Like many others - I dropped Cordova and Ionic in favor of React-Native. So, what is Ionic trying to do here? Are they throwing in the towel and adopting React? Will they end up making a kit that renders native components using JSX just like React-Native?
- danbucholtz 9y agoThere are hundreds of thousands of people using Ionic so we're certainly not throwing in the towel. One of the goals when creating Ionic was to build re-useable components that could be used by anyone. At the time (2013), this wasn't really feasible, so we went all in on Angular. Now that Web Component adoption in browsers is pretty solid, it has enabled us to fulfill the original vision of enabling developers using any web-based toolset to build incredible apps. We're all in on web tech. We think it's the smarter choice long term.
- yesimahuman 9y agoThe point is that you push more work to the browser, which has let us get a lot more load performance, much smaller bundle sizes, and much snappier apps and mobile websites (PWAs). We use React and Angular quite a bit internally at Ionic and the reality is that both produce very large code bundles and pulling those apart is proving to be a really hard technical challenge. We're not throwing in the towel at all, rather we're embracing web standards 100% and think Ionic is and will continue to be the best way to build an app that works in the app stores, on the web as a PWA, and increasingly on desktop. Cross-platform is our main focus.
- dgregd 9y ago> Like many others - I dropped Cordova and Ionic in favor of React-Native. Few years ago PhoneGap apps were really slow and ugly. So I built native Android app. This year I started building hybrid Ionic 3 app because it has to work on Android and iOS. It works good enough on Nexus 5 (Snapdragon 800). The biggest problem is 4-5 seconds startup time. Stencil and component lazy loading should greatly reduce that startup time (to 1-2 seconds I hope).
- timwis 9y agoI'm curious, why build this instead of using [skatejs](https://github.com/skatejs/skatejs https://github.com/skatejs/skatejs)?
- brosky117 9y agoWhat is the browser support for web components? I worry that tools like this are only targeting the last two versions of the major vendors.
- ergo14 9y agoIE11+ will work and everything modern. If you don't have native support things get polyfilled. Youtube nowdays runs on Polymer, web components and they support older browsers.
- Pranz 9y agoDoes not work in firefox developer addition. Navbars work fine but nothing else.
- chrisco255 9y agoDoes this mean we will be able to use Ionic components with React or Vue in the not too distant future?
- ergo14 9y agoYou will be able with Vue and preact, react has some issues (that hopefully will be adressed soon). https://custom-elements-everywhere.com/ https://custom-elements-everywhere.com/ check this site for more info.
- sampath-lokuge 9y agoWhy did it name as stenciljs? Hope it is TS no? Then it should be setncil no?
- deleted 9y ago[deleted]
- rajangdavis 9y agoThank you for this, was looking for something like this!
- saltydogdev 9y agoAs kind of an old dog, I can't help but think of Active X controls from back in the day. That's what this reminds me of. Kinda. Are there some guidelines and standardization of the kinds of events components emit, and what data is passed with the event? So that I don't have to look up all the variants of event names and data.
- gramstrong 9y agoA custom element is just an HTML element, so it is a part of the HTML standard. If you log the object you can see it has all of the same properties as an HTML element, plus whatever you've extended it with. So all emitting events and event callbacks will behave the same as a standard element (except for any custom event listeners and emitters that you add).
- manmal 9y agoI see two problems with stenciljs at the moment, but perhaps they can be fixed? 1, going back and forth in browser history, there is a flash of the footer being displayed before the actual content is loaded - it's just 1-2 frames, but very noticeable and disturbing. 2, scroll position is lost when visiting another page and going back. Those are typical single page app problems, but they will probably not matter when using the framework for a hybrid app (no back button). If I'm to use this for a web app though, those would be nice to have addressed.
- asdfgadsfgasfdg 9y ago> scroll position is lost when visiting another page and going back Who ever thought that keeping scroll position was a good idea anyway? Use #s if the position is relevant.
- kleptomac 9y agoAm I getting this right? Stenciljs is: * Another way to create web components - using Typescript/JSX. * Provides SSR support Other than that: * Is there anything else that we get from stenciljs? * How is it different from Polymer? * What Polymer problems does it solve?