Skip to content

Commit 2ecdcff

Browse files
committed
add blog layout
1 parent 0035cb1 commit 2ecdcff

34 files changed

+105
-67
lines changed

perf/todomvc-benchmark/vue/bower_components/vue/vue.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
License: MIT
55
*/
66
;(function(){
7+
'use strict';
78

89
/**
910
* Require the given path.
@@ -818,9 +819,12 @@ var utils = module.exports = {
818819
if (hasClassList) {
819820
el.classList.remove(cls)
820821
} else {
821-
el.className = (' ' + el.className + ' ')
822-
.replace(' ' + cls + ' ', '')
823-
.trim()
822+
var cur = ' ' + el.className + ' ',
823+
tar = ' ' + cls + ' '
824+
while (cur.indexOf(tar) >= 0) {
825+
cur = cur.replace(tar, ' ')
826+
}
827+
el.className = cur.trim()
824828
}
825829
}
826830
}
@@ -3493,10 +3497,10 @@ require.alias("component-emitter/index.js", "vue/deps/emitter/index.js");
34933497
require.alias("component-emitter/index.js", "emitter/index.js");
34943498

34953499
require.alias("vue/src/main.js", "vue/index.js");
3496-
if (typeof exports == "object") {
3497-
module.exports = require("vue");
3498-
} else if (typeof define == "function" && define.amd) {
3499-
define(function(){ return require("vue"); });
3500+
if (typeof exports == 'object') {
3501+
module.exports = require('vue');
3502+
} else if (typeof define == 'function' && define.amd) {
3503+
define(function(){ return require('vue'); });
35003504
} else {
3501-
this["Vue"] = require("vue");
3505+
window['Vue'] = require('vue');
35023506
}})();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
title: Why You Should Give Vue.js a Spin
2+
date: 2014-02-07 22:34:12
3+
---
4+
5+
## Simplicity
6+
7+
## Expressiveness
8+
9+
## Composability
10+
11+
## Flexibility
12+
13+
## Performance
14+
15+
## Comparison with Other Libraries
16+
17+
I think the only serious users right now are us here at Google Creative Lab, but hey, I just launched it to public this week! Speed is actually not the major selling point of Vue - simplicity is. Also, Vue is only an interface library, not a framework. For larger projects it's intended to be used with a modular build system e.g. Component or Browserify. That said, here's why you'd want to give Vue a shot over several common frameworks:
18+
19+
### Angular
20+
21+
If you like everything about Angular you should definitely stick with it. But it's not perfect for everyone. Vue.js tries to provide the benefits of MVVM data binding while being overall much simpler, so you don't have to bend your mind around $digest vs. $apply, preLink vs. postLink, or how dependency injection works. The core API is just a constructor that can be extended with a bunch of options. Vue is also much less opinionated, giving you the flexibility to use it as the view layer in a custom front-end stack.
22+
23+
### Backbone
24+
25+
Backbone has a simple and friendly API, but it has no data binding and your View will be cluttered with lots of DOM manipulation. You'd have to resort to third party libs such as KnockBack or Rivets.js to achieve that, then it suddenly requires a lot of boilerplate and becomes not that simple. Also, hard dependency on jQuery... which you might not need if you are targeting modern browsers.
26+
27+
### Knockout
28+
29+
In modern browsers, using ES5 getter/setters gets rid of Knockout's awkward syntax of initializing everything with ko.observable() and getting/setting as invoking functions. Vue.js also provides a declarative way to nest and compose your ViewModels, which can be tricky in Knockout.
30+
31+
### Ember
32+
33+
Ember is philosophically almost the exact opposite of Vue: heavy, opnionated, all-encompassing, convention over configuration... if you are into that then Vue is probably not for you.
34+
35+
### React
36+
37+
React is probably the closest to Vue among all these libs in terms of areas covered and position in the stack. It is a great lib, but I'm not a fan of constructing all the HTML in JavaScript - I prefer to write actual HTML and work with the actual DOM, which is what Vue does. Since I'm also a designer, I find Vue's approach makes it easier to work with CSS. Finally, in React the DOM is almost completely abstracted away, but in Vue you still have the flexibility to reach down in custom directives.
38+
Take note these are my personal opinions and I'm most likely biased, but you are more than welcome to do your own research and see if you agree with me.
39+
40+
### Ractive
41+
42+
Very very similar. But Vue.js allows you to easily extend the vocabulary with custom directives and filters, a feature which Ractive doesn't seem to offer. Since both libraries
43+
44+
## Other Stats
45+
46+
### Performance
47+
48+
### Size

source/api/directives.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ type: api
33
order: 6
44
---
55

6-
# {{title}}
6+
## Data Binding Directives
7+
8+
> These directives can bind themselves to a property on the ViewModel, or to an expression which is evaluated in the context of the ViewModel. When the value of the underlying property or expression changes, the `update()` function of these directives will be called asynchronously on next tick.
79
810
### v-text
911

@@ -61,8 +63,9 @@ Create a child ViewModel for every item in the binding Array. These child ViewMo
6163
### v-on
6264

6365
- This directive requires exactly one argument.
66+
- This directive requires the value to be a Function or an expression.
6467

65-
Attaches an event listener to the element. The event type is denoted by the argument. For more details see [Listening for Events](/guide/events.html).
68+
Attaches an event listener to the element. The event type is denoted by the argument. It is also the only directive that can be used with the `key` filter. For more details see [Listening for Events](/guide/events.html).
6669

6770
### v-model
6871

@@ -76,15 +79,10 @@ Create a two-way binding on a form or editable element. Data is synced on every
7679

7780
Conditionally insert / remove the element based on the truthy-ness of the binding value.
7881

79-
### v-component
80-
81-
- This directive takes a registered asset id.
82-
83-
Compile this element as a child ViewModel with a registered component constructor. This can be used with `v-with` to inehrit data from the parent. For more details see [Composing ViewModels](/guide/composition.html).
84-
8582
### v-with
8683

8784
- This directive requires the value to be an Object or falsy.
85+
- You cannot use expressions with this directive.
8886

8987
Compile this element as a child ViewModel, using the binding value as the `data` option. Inside the template you can directly access properties on the binding value. This can be used in combination with `v-component`.
9088

@@ -107,6 +105,16 @@ You can simplify the template like this:
107105
</div>
108106
```
109107

108+
## Literal Directives
109+
110+
> Literal directives treat their attribute value as a plain string; they do not attempt to bind themselves to anything. All they do is executing the `bind()` function with the string value once.
111+
112+
### v-component
113+
114+
- This directive takes a registered asset id.
115+
116+
Compile this element as a child ViewModel with a registered component constructor. This can be used with `v-with` to inehrit data from the parent. For more details see [Composing ViewModels](/guide/composition.html).
117+
110118
### v-component-id
111119

112120
- This directive takes a registered asset id.

source/api/filters.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: api
33
order: 7
44
---
55

6-
# {{title}}
7-
86
### capitalize
97

108
*'abc' => 'Abc'*

source/api/global-methods.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: api
33
order: 5
44
---
55

6-
# {{title}}
7-
86
### Vue.extend( options )
97

108
- **options** `Object`

source/api/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: api
33
order: 1
44
---
55

6-
# {{title}}
7-
86
The `Vue` Class is the core of vue.js. It is a constructor that allows you to create ViewModel instances. Creating a ViewModel instance is straightforward:
97

108
``` js

source/api/instance-methods.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: api
33
order: 4
44
---
55

6-
# {{title}}
7-
86
## Data Changes
97

108
### vm.$watch( keypath, callback )

source/api/instance-properties.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: api
33
order: 3
44
---
55

6-
# {{title}}
7-
86
### vm.$el
97

108
- **Type:** `HTMLElement`

source/api/instantiation-options.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: api
33
order: 2
44
---
55

6-
# {{title}}
7-
86
## Data & Logic
97

108
### data

source/blog/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
blog_index: true
2+
---

source/examples/component.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: examples
33
order: 4
44
---
55

6-
# Vue + Component Example
7-
86
<img style="width:100%;max-width:737px" src="/images/component-example.png">
97

108
> This is a basic example of how to structure a modular Vue.js application using Component as the build system. For more details on this topic, see [Building Larger Apps](/guide/application.html).

source/examples/firebase.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: examples
33
order: 2
44
---
55

6-
# Firebase + Validation Example
7-
86
> This example uses [Firebase](https://www.firebase.com/) as the data persistence backend and syncs between clients in real time (you can try opening it in multiple browser tabs). In addition, it performs instant validation using Vue.js filters and triggers CSS transitions when adding/removing items.
97
108
<iframe width="100%" height="500" src="http://jsfiddle.net/yyx990803/2EN3Z/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

source/examples/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: examples
33
order: 1
44
---
55

6-
# GitHub Commits Example
7-
86
> This example fetches latest Vue.js commits data from GitHub's API and displays them as a list. You can switch between the master and dev branches.
97
108
<iframe width="100%" height="500" src="http://jsfiddle.net/yyx990803/KupQL/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

source/examples/todomvc.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: examples
33
order: 3
44
---
55

6-
# TodoMVC Example
7-
86
<iframe width="100%" height="500" src="/perf/todomvc-benchmark/vue/index.html" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
97

108
> This is a fully spec-compliant TodoMVC implementation in under 120 effective lines of JavaScript (excluding comments and blank lines). It is also [one of the fastest implementations](/perf/).

source/guide/application.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 11
44
---
55

6-
# {{title}}
7-
86
Vue.js is designed to be as flexible as possible - it's just an interface library that doesn't enforce any architectural decisions. While this can be very useful for rapid prototyping, it could be a challenge for those with less experience to build larger scale applications with it. The following is an opinionated perspective on how to organize larger projects when using Vue.js.
97

108
## Build with Component

source/guide/composition.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 10
44
---
55

6-
# {{title}}
7-
86
## Registering a Component
97

108
Vue.js allows you to treat registered ViewModel constructors as reusable components. To register a component, use the global `Vue.component()` method:

source/guide/computed.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 8
44
---
55

6-
# {{title}}
7-
86
Vue.js' inline expressions are very convenient, but the best use cases for them are simple boolean operations or string concatenations. For more complicated logic, you should use **computed properties**.
97

108
In Vue.js, you define computed properties with the `computed` option:

source/guide/directives.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 3
44
---
55

6-
# {{title}}
7-
86
## Synopsis
97

108
If you have not used AngularJS before, you probably don't know what a directive is. Essentially, a directive is some special token in the markup that tells the library to do something to a DOM element. In Vue.js, the concept of directive is drastically simpler than that in Angular. A Vue.js directive can only appear in the form of a prefixed HTML attribute that takes the following format:

source/guide/events.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 6
44
---
55

6-
# {{title}}
7-
86
You can use the `v-on` directive to bind event listeners to DOM events. It can be bound to either an event handler function (without the invocation parentheses) or an inline expression. If a handler function is provided, it will get the original DOM event as the argument. The event also comes with an extra property: `targetVM`, pointing to the particular ViewModel the event was triggered on:
97

108
``` html

source/guide/filters.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 4
44
---
55

6-
# {{title}}
7-
86
## Synopsis
97

108
A Vue.js filter is essentially a function that takes a value, processes it, and then returns the processed value. In the markup it is denoted by a single pipe (`|`) and can be followed by one or more arguments:

source/guide/forms.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 7
44
---
55

6-
# {{title}}
7-
86
You can use the `v-model` directive to create two-way data bindings on form input elements and elements with `contenteditable` attribute. It automatically picks the correct way to update the element based on the input type.
97

108
**Example**

source/guide/index.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 2
44
---
55

6-
# {{title}}
7-
86
## Introduction
97

108
Vue.js is a library for building interactive web interfaces.
@@ -69,7 +67,7 @@ You can also use mustache-style bindings, both in text and in attributes. They a
6967
<div id="person-&#123;&#123;id&#125;&#125;">Hello &#123;&#123;name&#125;&#125;!</div>
7068
```
7169

72-
In addition, you can use triple mustaches for unescaped HTML, which translate to `v-html` internally. However, since this can open up window for potential XSS attacks, it is suggested that you only use triple mustaches when you are certain about the security of the data source.
70+
<p class="tip">You can also use triple mustaches for unescaped HTML, which translate to `v-html` internally. However, since this can open up window for potential XSS attacks, it is suggested that you only use triple mustaches when you are certain about the security of the data source.</p>
7371

7472
### Filters
7573

source/guide/installation.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ title: Installation
22
type: guide
33
order: 1
44
vue_version: 0.8.3
5-
dev_size: 91.37
6-
min_size: 32.20
7-
gz_size: 11.00
5+
dev_size: 91.49
6+
min_size: 32.25
7+
gz_size: 11.02
88
---
99

10-
# {{title}}
11-
1210
> **Compatibility Note:** Vue.js does not support IE8 and below.
1311
1412
## Standalone

source/guide/list.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 5
44
---
55

6-
# {{title}}
7-
86
You can use the `v-repeat` directive to repeat a template element based on an Array of objects on the ViewModel. For every object in the Array, the directive will create a child ViewModel using that object as the data object. On and inside the template element you have access to properties of both the child ViewModel and the parent ViewModel. In addition, you also have access to the current child ViewModel's `$index` property, which is the index of its data object in the Array.
97

108
**Example:**

source/guide/transitions.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ type: guide
33
order: 9
44
---
55

6-
# {{title}}
7-
86
You can add transition effects when elements are inserted into or removed from the DOM using the `v-transition` directive. There are two types of transitions: CSS-based and JavaScript-based. All Vue.js transitions are triggered only if the DOM manipulation was applied by Vue.js, either through built-in directives, e.g. `v-if`, or through ViewModel instance methods, e.g. `vm.$appendTo()`.
97

108
## CSS Transitions

themes/vue/layout/layout.ejs

+4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
<%- partial('partials/header') %>
2222
<% } %>
2323
<div id="main">
24+
<% if (page.blog_index) { %>
25+
<%- partial('partials/blog') %>
26+
<% } else { %>
2427
<%- body %>
28+
<% } %>
2529
</div>
2630
<script src="/js/common.js"></script>
2731
</body>

themes/vue/layout/page.ejs

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<%- partial('partials/sidebar', { type: page.type, index: page.index }) %>
33
<% } %>
44
<div class="content <%- page.type ? page.type + ' with-sidebar' : '' %>">
5+
<h1><%- page.title %><%- page.type === 'examples' ? ' Example' : '' %></h1>
56
<%- page.content %>
67
</div>

themes/vue/layout/partials/blog.ejs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<% site.posts.sort('date', -1).each(function (post) { %>
2+
<div class="content">
3+
<h4><%- post.date.format('MMM D[,] YYYY') %></h3>
4+
<h1><a href="/<%- post.path %>"><%- post.title %></a></h2>
5+
<div><%- post.content %></div>
6+
</div>
7+
<% }) %>

0 commit comments

Comments
 (0)