單頁應用框架:knockout-spa

fpcm 10年前發布 | 28K 次閱讀 前端技術 knockout-spa

用Knockout, Require, Director, jQuery, Sugar搭建的單頁程序(SPA Single Page Application)框架。

A mini (less than 200 LOC but full-fledged) SPA framework built on top of:

  • Knockout (MVVM)
  • Require (Module Organizer/Loader/Optimizer)
  • Director (Router)
  • jQuery (DOM Utilities)
  • Sugar (FP/Low Level Utilities

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
  • CSS will be inlined and minified into lib.css and app.css for production, so don't be wary about the@importlines in those 2 CSS files - only importing during development
  • No any grunt/gulp/watcher tasks required during development - you debug directly the exact same JS/CSS/HTML file you edit in the IDE. Only build task required for production is the RequireJS r.js optimizer task that's already predefined in build.js. Just figure out a config-based way to serve the assets from /build for production
  • 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

項目主頁:http://www.baiduhome.net/lib/view/home/1430405826537

 本文由用戶 fpcm 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!