#8 楼 @lidashuang 你去 clone 一份 todomvc 然后
cd architecture-examples
for i in *;do find $i | grep 'js$' | grep -v components | grep -v lib | xargs wc -l;done > result.txt
看看实现同样功能所需的代码量就知道了,这还是简单的功能,要是想做点复杂的,算上各种库的体积,呵呵
#16 楼 @lidashuang 呵呵,我说的光是 自己要写的代码 多么?自己实际去看一下总体成品体积很难么?
169 angularjs/js/directives/todoFocus.js.minified
127 angularjs/js/directives/todoBlur.js.minified
212 angularjs/js/services/todoStorage.js.minified
54 angularjs/js/app.js.minified
913 angularjs/js/controllers/todoCtrl.js.minified
2920 angularjs/bower_components/todomvc-common/base.js.minified
88802 angularjs/bower_components/angular/angular.js.minified
13379 angularjs/bower_components/angular-mocks/angular-mocks.js.minified
206 angularjs/test/config/testacular.conf.js.minified
726 angularjs/test/unit/directivesSpec.js.minified
2850 angularjs/test/unit/todoCtrlSpec.js.minified
110358 总用量
1805 backbone/js/views/app.js.minified
1201 backbone/js/views/todos.js.minified
215 backbone/js/routers/router.js.minified
167 backbone/js/models/todo.js.minified
66 backbone/js/app.js.minified
438 backbone/js/collections/todos.js.minified
2920 backbone/bower_components/todomvc-common/base.js.minified
94839 backbone/bower_components/jquery/jquery.js.minified
2483 backbone/bower_components/backbone.localStorage/backbone.localStorage.js.minified
19563 backbone/bower_components/backbone/backbone.js.minified
14219 backbone/bower_components/underscore/underscore.js.minified
137916 总用量
压缩后,这 backbone 实现比 angularjs 实现算上测试代码还大差不多 1/4,这尼玛叫轻量级?要是光算自己需要写的代码数,更是甩好几条街了,backbone 本身太小,然后你自己要干的事情反而多了
#22 楼 @lidashuang 你是说,如果用 angularjs 还用 jquery? 难道你不知道 angularjs 入门第一件事情就是Don't even use jQuery么……