基于Knockout的单页程序(SPA)框架 knockout-spa
发布于 10 年前 作者 onlyurei 4734 次浏览 最后一次编辑是 8 年前 来自 分享

今天刚开源,文档还很欠缺。不过项目文件应该是自说明的。欢迎大家的feedback! https://github.com/onlyurei/knockout-spa

knockout-spa

Take a SPA with Knockout.

What is this?

  • A mini (but full-fledged) SPA framework built on top of Knockout, Require, Director, jQuery, Sugar.
  • 1.0.0

How do I use it?

  • All required files are in the repo already
  • Take a look at the file structure and comments/TODOs in the bootstrapped setup - you’ll figure out everything in 30 minutes
  • Only needed external thing is the RequireJS optimizer r.js, just run npm install in the repo

Features

  • Routing (based on Flatiron’s Director): HTML5 history (pushState) or hash.
  • Highly composable and reusable: pick modules/components for a page in the page-specific JS and they will be auto-wired for the page’s HTML template
  • SEO ready (prerender.io)
  • Fast and lightweight (85 KB of JS minified and gizpped)
  • Two-tier bundle build for JS for production: common module that will be used by most pages, and page-specific modules that will be lazy-loaded
  • Organized folder structure to help you stay sane for organizing and reusing JS, CSS, HTML
  • Using Knockout 3.3.0+ so ready for Knockout’s flavor of web component and custom tags (http://knockoutjs.com/documentation/component-overview.html)
  • All documentation are in the major dependencies’ own homepages, so that you don’t need to completely learn a new framework

Demo

Seeing/hacking is believing, here you go.

RentEver - Social Rental Marketplace http://rentever.com

3 回复

我英文不好,所以弱弱的问句这个是干嘛的?

@satrong 做单页程序的一个用各个库搭出来的一个微型框架。麻雀虽小,五脏俱全哈。

@onlyurei 很牛逼的样子

回到顶部