Trên GitHub, jorgebucaran/superfine đã đạt 1.6k sao, ngôn ngữ JavaScript. Absolutely minimal view layer for building web interfaces
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Superfine is a minimal view layer for building web interfaces. Think Hyperapp without the framework—no state machines, effects, or subscriptions—just the absolute bare minimum (1 kB minified+gzipped). Mix it with your favorite state management library or use it standalone for maximum flexibility.
Here's the first example to get you started. Try it here—no build step required!
When describing how a page looks in Superfine, we don't write markup. Instead, we use the h() and text() functions to create a lightweight representation of the DOM (or virtual DOM for short), and patch() to actually render the DOM.
Superfine won't re-create the entire DOM every time we use patch(). By comparing the old and new virtual DOM we are able to change only the parts of the DOM that need to change instead of rendering everything from scratch.
Next up, let's take a look at a simple todo app. You can only add or cross off todos with it. Can you figure out what's happening just by poking around the code a bit? Have a go here.
Now it's your turn to take Superfine for a spin. Can you add a button to clear all todos? How about bulk-marking as done? If you get stuck or would like to ask a question, just file an issue and I'll try to help you out—have fun! ✨
Installation
npm install superfine
Top-Level API
h(type, props, [children])
Create them virtual DOM nodes! h() takes the node type; an object of HTML or SVG attributes, and an array of child nodes (or just one child node).
Superfine nodes can use any of the HTML attributes, SVG attributes, DOM events, and also keys.
class:
To specify one or more CSS classes, use the class attribute. This applies to all regular DOM and SVG elements alike. The class attribute expects a string.
Use the style attribute to apply arbitrary CSS rules to your DOM nodes. The style attribute expects a string.
Important: We don't recommend using the style attribute as the primary means of styling elements. In most cases, class should be used to reference classes defined in an external CSS stylesheet.
Keys help identify nodes whenever we update the DOM. By setting the key property on a virtual DOM node, you declare that the node should correspond to a particular DOM element. This allows us to re-order the element into its new position, if the position changed, rather than risk destroying it.
Important: Keys must be unique among sibling nodes.
Superfine will patch over server-side rendered HTML, recycling existing content instead of creating new elements. This technique enables better SEO, as search engine crawlers will see the fully rendered page more easily. And on slow internet or slow devices, users will enjoy faster time-to-content as HTML renders before your JavaScript is downloaded and executed.
Notice that all the necessary HTML is already served with the document.
Superfine expects the markup to be identical between the server and the client. Treat mismatches as bugs and fix them! Now you just need a way to send content to browsers.
JSX
JSX is a language syntax extension that lets you write HTML tags interspersed with JavaScript. To compile JSX to JavaScript, install the JSX transform plugin, and create a .babelrc file in the root of your project like this:
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/jorgebucaran/superfine là nguồn chính thức.
jorgebucaran/superfine có bao nhiêu sao?
jorgebucaran/superfine có 1.6k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/jorgebucaran/superfine. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
jorgebucaran/superfine có phải mã nguồn mở không?
Có — jorgebucaran/superfine phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/jorgebucaran/superfine.
jorgebucaran/superfine còn đang phát triển không?
Commit gần nhất trên jorgebucaran/superfine là 4.3 năm trước (theo timestamp GitHub). Repo có 77 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
jorgebucaran/superfine dùng license gì?
jorgebucaran/superfine phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
jorgebucaran/superfine là gì?
jorgebucaran/superfine (jorgebucaran/superfine) là dự án JavaScript trên GitHub. Theo mô tả gốc: Absolutely minimal view layer for building web interfaces
jorgebucaran/superfine viết bằng ngôn ngữ gì?
jorgebucaran/superfine chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về superfine?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về superfine.